Following along with Crafting Interpreters, in Swift.
swift run slox
to run REPLswift run slox path/to/script.lox
to run scriptswift run slox path/to/script.lox --print
to output Graphviz of ASTswift run genslox
to regenerate code
To make this language more my own, I'd like to change a few things about Lox.
- Remove nil
- Remove semicolons
- Remove parentheses from conditionals; require block statement
- Add +=, -=, /=, *= operators
- Remove ability to invoke initializer directly
- Rewrite
Parser
match()
calls with pattern matching; look atif
-chains! - Distinguish statement-starting tokens from other tokens?