compiler: add fixnums Word{64,32,16,8}, Int{64,32,16,8} - #276
Conversation
|
after this a good issue to tackle would be #58 |
ff05416 to
f9db535
Compare
|
I'd also like to do the bounds checking of the fixnums by wrapping them in a macro but I'm not sure exactly how to do that. So a |
oh no that one is even bigger than the other MR 😩 I'll never manage to get through both of those in their entirety. should we try splitting them into smaller MRs, or just merge them as-is and hope for the best? |
I'm sorry!! Yes I had a 8 hour flight and then a 13 hour flight to Singapore for ICFP so I just decided to add them all. I'll keep it small next time |
0b4de63 to
936a880
Compare
Ah, I think I finally understand the confusion! The |
| | SyntaxPatternWord64 Ident Var | ||
| | SyntaxPatternWord32 Ident Var | ||
| | SyntaxPatternWord16 Ident Var | ||
| | SyntaxPatternWord8 Ident Var |
There was a problem hiding this comment.
we should really prioritize #184, you are wasting effort adding features to a deprecated system!
|
@gelisam I'm stuck on the remaining 4 failing examples :/ if these are intractable then perhaps it does make sense to add sized literals like |
|
|
|
Then the only remaining difference in the output is the position within the file where the syntax objects |
|
the There are two difficulties:
For those two reasons, I think it would make more sense if integer literals were monomorphic in that |
|
after fixing those 3 tests, the entire test suite succeeds for me. what is the 4th failing test on your side? |
Thanks for the help. The last remaining is |
b258437 to
7a47f67
Compare
and example/fixnums.kl
and associated operations such as:
- {word|int}{8|16|32|64}{<|>|<=|>=|=}
- {word|int}-compliment,-popcount,->string
- {word|int}{8|16|32|64}->string
and redefine #%integer-literal to not assume an Integer.
7a47f67 to
ea9d5da
Compare
| Type mismatch at not-a-function.kl:3.11-3.13. | ||
| Expected (Integer → (?1 → ?2)) but got Integer | ||
| Type mismatch at not-a-function.kl:3.24-3.26. | ||
| Expected (?1 → (?2 → ?3)) but got Integer |
There was a problem hiding this comment.
since not-a-function.kl specifically annotates that the 42 has type Integer, I don't understand why the error message changed?
this is not a blocker.
| (example (the Int8 256)) -- note no bounds checking with the primitives this is 0 | ||
| (example (int32-popcount 0xFF)) -- 8 | ||
| (example (int8-+ 42 50)) | ||
| (example (int8-compliment 7)) -- will be -8 because 2's complement |
There was a problem hiding this comment.
| (example (int8-compliment 7)) -- will be -8 because 2's complement | |
| (example (int8-complement 7)) -- will be -8 because 2's complement |
| | Word64 Word64 | ||
| | Word32 Word32 | ||
| | Word16 Word16 | ||
| | Word8 Word8 |
There was a problem hiding this comment.
hmm, I remember we decided that 42 would be a polymorphic syntax which can either have time Int8, Integer, or whatever, depending on the context? If so, it doesn't make sense for ExprF to have a constructor for Int8 etc., as there is no dedicated 42u8 syntax for it. Similarly, there should not be a Syntax-Contents constructor for Int8 either.
❌ this is a blocker
There was a problem hiding this comment.
(nor a CoreInt8Syntax constructor)
Co-authored-by: Samuel Gélineau <gelisam@gmail.com>
and example/fixnums.kl
todos: