3 ms·
I agree it is a bad book, but you don't seem to be explaining why.
by zabzonk 4y ago
I agree it is a bad book, but you don't seem to be explaining why.
- astrange 4y agoThe article says exactly what I'd say. It spends far too much time explaining the frontend (parsing theory) which isn't the difficult or important part of the compiler, and it somehow makes it sound scary and mathematical. The rest isn't covered enough and doesn't have enough practical real-world advice.
- necheffa 4y agoAs someone who has had to clean up (with backwards compatibility) after people who YOLO'd custom grammars rather than actually taking the time to respect the mathematics of parsing and design ambiguity out up front... I cannot disagree with you more.
- astrange 4y agoI mean, I think you should read a book on parsing theory, just not that one. I like "Parsing Techniques: A Practical Guide" but there might be a newer better one. But clang and gcc both have handwritten recursive-descent parsers for C/C++. (C++ parsing of course is undecidable, or at least used to be.)
- samatman 4y agoC++ parsing being undecidable, and C having the Most Vexing Parse, are the classic arguments for developing a grammar using a parser generator, and only when the grammar is mature, write a handrolled implementation using the grammar as a reference. I happen to think generating useful software from declarative grammar specifications is, hmm. Not limited to what such frameworks have been capable of to date. Although if you've only worked with yacc/bison, and never ANTLR, you may be underestimating the quality of a generated parser with respect to error recovery and messages. The state of the art has advanced, I don't think anyone would claim parity with artisanal handcrafted softwares, but we can get a lot more than "barf: shift-reduce bunchanumbers" these days.
- zabzonk 4y ago> and C having the Most Vexing Parse C++ too. Just to be pedantic.
- dgunay 4y agoI can echo this sentiment. Last year I took a course for my master's where we implemented a compiler end to end. The dragon book helped for most of it but when it came time to implement the assembler we were unable to get it completely correct and the book was very scant on any information about how to best manage going from virtual to physical registers, handle storing information on the stack, etc. Granted some of that is platform specific but the difference in material from frontend to backend was stark.
- mhh__ 4y agoParsing is also about 1% of the effort for a mature frontend. Books do not cover how to actually structure a compiler and write sensible passes etc.
- oxff 4y agoFrontend is very important if you want your language to have good IDE tooling (which most languages do not have)