
Show HN: Walnut – A tree-walking Interpreter in C++ - p-ranav
https://github.com/p-ranav/walnut
======
mepian
It's always great to see new people work on their own programming languages,
but I have to ask: why a tree-walking interpreter? This is probably the least
optimal way to implement a language, whether you are a beginner or not. While
interpreters are often believed to be the right way for beginners to implement
languages, compilers are actually much easier to write, much easier to
maintain, and yield much better performance than interpreters if you are doing
anything more than a throwaway exercise, and judging by this Github page your
ambitions are larger than that. If you don't know where to start with
compilers, I recommend reading Abdulaziz Ghuloum's "An Incremental Approach to
Compiler Construction" paper [0], and then moving on to Andrew Appel's "Modern
Compiler Implementation in ML" book.

[0]
[http://scheme2006.cs.uchicago.edu/11-ghuloum.pdf](http://scheme2006.cs.uchicago.edu/11-ghuloum.pdf)

~~~
p-ranav
Thanks for the feedback. Yes, I agree. This is not optimal. The project was
more a learning experience for me with language interpretation. I have since
learned that it is better to implement a byte-code emitter and a stack-based
VM. I just wanted to get the tree-walker to a reasonable place before moving
on.

Thanks for the links. These are valuable.

