TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Tell HN: The dragon compiler book (2nd edition) is a great book

49 pointsby jobhdezalmost 2 years ago
Hello,<p>I have seen a lot of people on the internet say that the dragon book is horrible book to learn compilers from.<p>well, I have read some of the second edition of the dragon book and I think it is a great book. The main criticism is that its too focused on parsing. Thats just like 5 chapters. I skipped these and went straight into the intermediate language, code generation, and optimizing chapters.<p>These chapters give a detailed account of things such as register allocation, instruction selection, and instruction scheduling. The optimizing chapters are also good.<p>im not claiming im an expert compiler person. I am not but compilers is something i want to learn and so i gave the dragon book a try and i really liked it.<p>more importantly the dragon book made me realize that compilers are mathematical systems in a way. the ast is tree and trees have mathematical properties but graphs are needed for register allocation, dataflow analysis for optimization. optimization is math problem.<p>So i think this book gave me a better understanding of the field and it made appreciate compilers.<p>i&#x27;d say if youre interested in compilers you can start with &quot;essence of compilation&quot; by dr. siek and get some experience writing compilers and then read the dragon book.<p>i just wanted to share my experience. i think the dragon book is a great book.

13 comments

sanxiynalmost 2 years ago
Besides devoting too many pages to parsing, I think compiler practitioners have low opinion of the book because it isn&#x27;t useful for them. For example, the second edition claims to be updated to modern optimization techniques, and in a sense that&#x27;s true, but it is useless because the book isn&#x27;t using SSA. For practitioners, SSA is not optional these days, and everything about optimization in the book needs to be updated to SSA to be useful.<p>But you are probably not a compiler practitioner. Then I agree it is a good book to learn about compilers.
评论 #36148294 未加载
评论 #36163422 未加载
评论 #36147848 未加载
eskaalmost 2 years ago
From the parsers I see in the wild (not strictly speaking about compilers here), I think most programmers should definitely spend some time studying the basics of them. It’s incredible to me how people mess up parsing even the simplest of file formats or make it super complicated.
评论 #36147675 未加载
评论 #36147568 未加载
评论 #36148346 未加载
评论 #36147445 未加载
Areliusalmost 2 years ago
For those that find it a bit light, I enjoyed Advanced Compiler Design and Implementation by Steven S. Muchnick. Which covers topics that I found much trickier.
ndesaulniersalmost 2 years ago
I think the third edition of Engineering a Compiler was recently published (paperback only, WTH). I found that to be a better read IMO.
评论 #36148431 未加载
laichzeit0almost 2 years ago
I remember picking this book up at the university library in my second year because I had seen it in the movie “Hackers” and the cover looked really cool. I distinctly remember the parsing chapters especially recursive descent parsing. It was one of those light bulb “oh, this is how you do it” moments. Well worth spending a few weekends playing with that book, even if it’s somewhat dated, its like SICP in a sense more of a “mind expansion” device than anything else.
评论 #36148442 未加载
评论 #36147829 未加载
flashgordonalmost 2 years ago
Amen. This is will have a permanent place in my bookshelf. I actually found that implementing some of the papers was very valuable (and joyful). Not only that this stuff points you to a lot more research generated after the book. Even better is that each paper you implement imo was very self contained on its own so you can build and use as you go.
markus_zhangalmost 2 years ago
What is a good book just for recursive descend parsing? I dabbed into some compiler books but found BNF difficult.<p>Just some clarification, it is not difficult to understand but difficult to build from scratch. I&#x27;m thinking maybe a book that asks me to build up BNF expressions for a series of grammars of gradually increasing complexity would be nice.
评论 #36152543 未加载
评论 #36149897 未加载
评论 #36150007 未加载
farglealmost 2 years ago
seconded.<p>so a lot of people say a lot of things. i like chapters 1-5 just as much as the rest, btw. it&#x27;s objectively a great book, written by objectively great developers <i>and</i> computer scientists.<p>is it the best to learn from today? who can say.<p>you might also say we should not start the education for structural engineering by studying the Brooklyn bridge either.<p>but, so here we are.
评论 #36147883 未加载
评论 #36148403 未加载
Yizahialmost 2 years ago
Reminds me of this thread :) <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=3754545" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=3754545</a><p>Since it&#x27;s so old that blog post is dead now, here is an archive copy: <a href="https:&#x2F;&#x2F;web.archive.org&#x2F;web&#x2F;20180929002914&#x2F;http:&#x2F;&#x2F;www.billthelizard.com&#x2F;2008&#x2F;12&#x2F;books-programmers-dont-really-read.html" rel="nofollow">https:&#x2F;&#x2F;web.archive.org&#x2F;web&#x2F;20180929002914&#x2F;http:&#x2F;&#x2F;www.billth...</a>
deterministicalmost 2 years ago
I make a living as a high-performance JIT compiler writer, and the dragon book is a waste of time in my opinion. There are much better books out there. If you are a beginner, start by learning Recursive Descend parsing. And then learn LLVM.
评论 #36184255 未加载
kaba0almost 2 years ago
I had greater experience with Cooper and Torczon’s Engineering a Compiler book, I can only recommend it.
eimrinealmost 2 years ago
I have the first edition but do not have an intention to create compilers yet, and the book is the hardest book I have for recreational reading. I can not just open it in the middle and find anything understandable.
评论 #36148496 未加载
ryanmerceralmost 2 years ago
&quot;<i>green book</i> International Unix Environments. <i>orange book</i> Computer security criteria, DOD standards. <i>book with man wearing pink shirt</i> The Pink Shirt Book, Guide to IBM PCs. So called due to the nasty pink shirt the guy wears on the cover <i>another book</i> Devil book. The Unix Bible. <i>another book</i> Dragon book. Compiler design. <i>large red book</i> The Red Book. NSA Trusted Networks. Otherwise known as the Ugly Red Book that won&#x27;t fit on a shelf.&quot;<p>Sorry, title took me down a nostalgic trip.