Hacker News new | past | comments | ask | show | jobs | submit login

I vividly remember learning about recursive descent parsing in my compilers class and thinking, "Wow, I can use this everywhere!"

Of course in addition to executing an AST you can also generate CODE for it...




> Of course in addition to executing an AST you can also generate CODE for it...

Yes! In the third part of the book [1], we'll do exactly that. The C interpreter's parser generates bytecode as it parses. I haven't written the text yet (that's the hard part...) but you can see the code for it here [2].

[1]: http://www.craftinginterpreters.com/a-bytecode-virtual-machi...

[2]: https://github.com/munificent/craftinginterpreters/blob/mast...


That will be awesome.


Recursive descent is still a great way to implement parsers.


"Recursive descent" is an ancient African expression meaning "I can't write grammars".


Most production compilers still depend on recursive descent because (a) it isn't that much harder compared to the generative approach, and (b) it is the best way to work in real error recovery or to support IDE services.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: