Crafting Interpreters
craftinginterpreters.com
craftinginterpreters.com
https://grugbrain.dev/#grug-on-parsing
recursive descent parsing is simple, beautiful, intuitive, flexible, shows the correspondence between recursion and grammars and it's how most production compilers are built
this book is the best (and one of the only) books to cover it in depth
it belongs on every programmers shelf
it made me smile
Anyway, recursive parsers are too resource hungry to run on a PDP-11. That's why nobody teaches them. If you don't expect them to run on a PDP-11, then yes, all of that is true.
(Our academic institutions are stuck at the 70's, while our commercial institutions are stuck ignoring anything that is more than 10 years old. It's hard to train new developers on those conditions.)
This is going up on every vertical surface at the office.
> unfortunately many big brain school teach only parser generator tool. here grug usual love of tool is not: parser generator tool generate code of awful snakes nest: impossible understand, bottom up, what? hide recursive nature of grammar from grug and debug impossible, very bad according grug!
Depending on your language, creating a grammar and then creating a recursive descent parser based on it is a perfectly reasonable approach, and that's what most major programming languages do.
For experimental stuff like https://hyperscript.org I wing it a bit more, but that's the flavor of that language.
The book was very well done, both in artwork, writing style, and explanations.
* Compilers, Principles, and Tools (the Dragon Book)
* Engineering a Compiler
You can skim a lot of the Dragon Book, but it will introduce you to a lot of the basics around type checking and generating code. Then Engineering a Compiler (which roughly assumes you have some familiarity with compilers already) does a very good job of walking through all of the key algorithms behind control flow analysis, register allocation, instruction selection, optimization, etc.
https://mitpress.mit.edu/9780262047760/essentials-of-compila...
Great author but also a fun conversationalist :)
[0] https://guide.handmade-seattle.com/c/2022/behind-crafting-in...