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 use parser rules to implement ordering and precdence of operations. We also explored some of the considerations in choosing functions or macros to implement certain language features.
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.