To make better line errors, we got clever about using exceptions to generate our errors by combining information from two places in the program.
To implement variables and input, we bit the bullet and modeled our BASIC variables as Racket variables. This made things a little harder at the outset, but paid dividends later. We saw how to use syntax properties left behind by splices in the parser to find occurrences of variables in the parse tree.
In expressions and conditionals, we learned how to implement associativity and precedence of operations with parser rules. We also considered the reasons to choose between functions and macros.
We’ll stay with BASIC just a little longer. But rather than implementing new statements, we’ll see how we can extend our implementation to cooperate with other Racket modules—whether written in BASIC, Racket, or something else. We’ll also see how to better integrate our language with the REPL and command line.