Support else-if statements #2

Open
opened 2022-03-02 21:59:10 +00:00 by mars · 0 comments
Owner

putting this here so that i can start working on lexical analysis without forgetting to implement this later

else-if expressions (not statements) are already supported, as they can build IfExprs immediately off of the trailing if and not worry about whether it has an else or not, since IfExpr ONLY builds with else clauses

else-if statements need to be able to automatically convert else-less if blocks into branch bodies without tail expressions, and else-ful if blocks into tail expressions, while still returning the tail token on failure

this is actually pretty simple but i'm tired of working on parser code and would really like to move onto semantics

for now i'm putting curly braces around else statements to make them work in the examples, i'll leave TODOs so that they can be reverted later

putting this here so that i can start working on lexical analysis without forgetting to implement this later else-if expressions (not statements) are already supported, as they can build `IfExpr`s immediately off of the trailing `if` and not worry about whether it has an `else` or not, since `IfExpr` ONLY builds with `else` clauses else-if statements need to be able to automatically convert else-less if blocks into branch bodies without tail expressions, and else-ful if blocks into tail expressions, while still returning the tail token on failure this is actually pretty simple but i'm tired of working on parser code and would really like to move onto semantics for now i'm putting curly braces around else statements to make them work in the examples, i'll leave TODOs so that they can be reverted later
Sign in to join this conversation.
No Label
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: mars/sprite-rs#2
No description provided.