-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
go: Add if statement parsing and evaluation #21
Conversation
Visit the preview URL for this PR (updated for commit d19c380): https://evy-lang--pr21-if-z6wg59s0.web.app (expires Fri, 23 Sep 2022 06:28:31 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some comments to keep you going.
Update output for end of line for readability from `<end of line>` to simply `end of line`. In the context of error messages the latter seems to read nicer.
078261e
to
b660b48
Compare
Parse `if` statements into If AST node. While at it, abstract the way we create block statements with a configurable set of terminating tokens. `else` for example is terminating for if statements, but not for function bodies, else bodies or loop bodies. Also update block statement parsing, to NOT parse past the END token so we can read and validate the block end token from the call site.
Add if statement evaluation to evaluator. Add bool constants TRUE, FALSE for easier comparison. Update index.html in frontend for code that evaluates, we don't yet parse and evaluate expressions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💚 LGTM
Add if statement parsing and evaluation - this is a pretty straight
forward PR, with only minor refactors around BlockStatment parsing and
bool constants during evaluation.