Basic floating point support (WIP) #18

Merged
j merged 9 commits from floats into main 2024-09-19 19:27:51 +00:00
Owner

Additions:

  • Float support in cl-lexer (though riddled with hacks)
  • Float support in the AST (smuggles floats inside u64, for now)
  • Float support in the tree-walk interpreter

Considerations:

  • Float 0.1 and Range 0..1 are ambiguous with only one token lookahead. It might be a better idea to push both int and float parsing into the parser, and disambiguate there?
  • Does not support the optional exponent form yet
  • Relies on Rust std for float parsing :(
Additions: - Float support in `cl-lexer` (though riddled with hacks) - Float support in the AST (smuggles floats inside u64, for now) - Float support in the tree-walk interpreter Considerations: - Float 0.1 and Range 0..1 are ambiguous with only one token lookahead. It might be a better idea to push both int and float parsing into the parser, and disambiguate there? - Does not support the optional exponent form yet - Relies on Rust std for float parsing :(
j added 9 commits 2024-09-19 19:26:03 +00:00
- operators
- type casting
It's disgusting, but better than nothing!
- Smuggle floats as integers to maintain `eq`
- This is bad, but not terrible for spec-compliant floats. Might have issues with NaN.

cl_parser: Smuggle floats

cl_interpret: unpack smuggled floats in float literal node
This requires more than one token lookahead, but is already part of a hack itself, so... /shrug
j added the
enhancement
label 2024-09-19 19:26:36 +00:00
j merged commit ae11d87d68 into main 2024-09-19 19:27:51 +00:00
j deleted branch floats 2024-09-19 19:28:10 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: j/Conlang#18
No description provided.