Didn’t I just do one of these? Well, yes. Yes I did. But I love building compilers and interpreters, so when I saw this one was in beta (and thus free 😉), I had to try it!
It’s directly an implemention of the Lox languages from the Crafting Interpreters website / book (my review), if incomplete. By the end of the lesson, we’ll have:
- A tokenizer that handles parentheses, braces, operators (single and multiple character), whitespace, identifiers, string literals, numeric literals, and keywords
- A parser that can take those tokens and build an abstract syntax tree using recursive descent parsing
- A simple tree walking interpreter for some subset of the language
It doesn’t handle all of the syntax (yet). In particular, we don’t have functions, control statements like if or while or custom classes. These seem… kind of important! But it’s a start and something I can definitely see myself building more on it.