|
|
|
|
|
by lukemerrick
1115 days ago
|
|
Disclaimer: I wrote this blog post. If this were an "Ask HN" post, though, the question would be "What next after reading Crafting Interpreters?" I have only done the tree-walk interpreter half of the book, but I'm already excited to move beyond Lox, and I'm curious to hear what others have done in this situation. |
|
Once you've done that, you can see how it's done "for real" in a production setting by reading the source code to Wren (by the same author). [0]
Wren's implementation maps very closely to the C implementation of Lox.
At that point, you're ready to do your own language. As far as compilation techniques go, you'll still be missing the "middle-end" of the compiler, which uses an SSA IR. I don't recommend implementing this yourself, I'd look into MLIR (from the LLVM project) if you want to actually work on the middle-end. You can create one or more dialects that are unique to your language, and implement your own compiler transformations. There are lots of existing papers and projects on GitHub demonstrating doing so.
[0] https://wren.io/