5 ms·
Planning to read this soon. Anyone got any other compiler book recommendations? Preferably modern (I've heard the dragon book is out of date)
by IAmLiterallyAB 2y ago
Planning to read this soon. Anyone got any other compiler book recommendations? Preferably modern (I've heard the dragon book is out of date)
- chin7an 2y agoI’ve not read this book, so can’t offer a comparison but Thorsten Ball’s two books [1] are great. The dragon book was my textbook in college, brings back memories, might be outdated but some concepts should still be useful. [1] https://thorstenball.com/books/ https://thorstenball.com/books/
- signaru 2y agoThorsten Ball's books are the closest thing to Crafting Interpreters. Not just by topic, but also with how the code is presented. By far these are among the few books I know that take the effort to guide the reader to programming something complex from scratch, while also being testable as the program grows. This means that previously presented code changes along the way as new features are added. A lot of other "code yourself" books, on the other hand, simply slice already finished codebases, and there's no way to test a simpler incomplete version of the program unless the reader makes extra effort and go beyond what is presented in the book. While there is a lot of overlapping topics in Nystrom's and Ball's books, there are also enough differences to learn something new from the other. Ball's books uses the same parser and AST as front ends to both tree-walking and VM interpreter. CI, on the other hand, skips the AST for the VM interpreter, and also teaches extra topics like implementing garbage collection, dictionaries/hashtables and class-based OOP.
- pansa2 2y agoEngineering a Compiler (Cooper and Torczon) seems to be widely recommended. I’ve got the second edition but there’s now a third - not sure how significant the changes are. AFAIK the problem with the dragon book is the same as with most academic compiler courses. It spends most of its time on the theory-heavy front-end (parsing) and much less on the back-end (code generation). Real-world compilers are very much the opposite.
- bmoxb 2y agoI think Engineering a Compiler is a great next step after Crafting Interpreters. It's both easier to get into (in terms of writing style and structure) and, as you say, generally more practical than the Dragon Book.
- eredengrin 2y agoDo you have any thoughts about how to read some of the next step books like Engineering a Compiler/Dragon Book? I don't normally read large technical books end to end so I'm curious how others approach it. I am going through Crafting Interpreters right now and I like how it has well defined checkpoints that help me know that I can move on when I understand the current material. I skimmed Engineering a Compiler and it looks like it has exercises as well, do you recommend all/some of those, or any other methods? Also I did some searching to see past discussions of Engineering a Compiler and found this interesting comment thread from Bob Nystrom for anyone interested: https://news.ycombinator.com/item?id=21725581 https://news.ycombinator.com/item?id=21725581
- munificent 2y agoI think everyone has to pick a strategy for consuming material that works best for their brain. For me, when I read textbooks, I tend to read them front to back. Only a fraction of it sticks on the first read through, but I accept that. I've tried to go really slow and do all of the exercises to make it all stick, but I usually just run out of steam and give up. I'd rather just get through the whole thing. Then, in the future, when I find myself needing some concept from the book, I usually remember at least that it is in the book. Then I go back and read that part more carefully. Now that it's relevant to a real problem I have, I tend to remember it much better after the second read through.
- eredengrin 2y agoThanks for the perspective, I sometimes have completionist tendencies so it's hard to skim without feeling I'm missing parts, but also it can certainly lead to motivation running out at times. And thanks for Crafting Interpreters, I am really enjoying it so far!
- Jtsummers 2y agohttps://mitpress.mit.edu/9780262047760/essentials-of-compilation/ https://mitpress.mit.edu/9780262047760/essentials-of-compila... Recent, that is the Racket version and the author has a Python version, too. Based on the nanopass compiler idea. It builds out the compilers over the course of the books.
- dils 2y ago"Writing An Interpreter In Go"[1] is also pretty good. I read it after finishing crafting interpreters. [1] https://interpreterbook.com/ https://interpreterbook.com/
- lolinder 2y agoDoes it provide information or techniques that aren't already covered by Crafting Interpreters, or was it more of a refresher?