Engineering a Compiler, 2nd Edition is out
elsevierdirect.com
elsevierdirect.com
http://news.ycombinator.com/item?id=1643787
I would hope that they have corrected this error in this version of the book, but their non-response to my report does not give me hope.
For beginners, this book rocks. It's readable, very well written, and very easy to follow. For intermediates, it has tons of interesting asides and anecdotes.
(All this applies to the first edition - I haven't read the second).
Finally, many people recommend the Dragon Book; I really really could not recommend it less. Buy Engineering a Compiler instead - there is really no comparison.
One thing that does appear missing from both books are some topics that should be of more interest... like compiling closures (and while it may only take a second of reflection to think of how to do it... its nice to have a textbook that also details it and any tricky corners that aren't obvious).
http://news.ycombinator.com/item?id=1408241
Otherwise, I'd recommend Engineering a Compiler, or Modern Compiler Design in X by Appel (where X is one of the languages in which the book is offered).
http://pragprog.com/titles/tpantlr/the-definitive-antlr-refe...
http://pragprog.com/titles/tpdsl/language-implementation-pat...
Having said that the book's major draw back is that is "soft" on the major topics of today: optimizations. The book is very frontend centered and mentions some possible optimizations in the final chapter--no implementations given. Hence, while I always recommend this book as the first go-to book, interested compiler programmers have to find supplemental material elsewhere. (I love M. Scott's "Programming Language Pragmatics", respect Grune, Bal, Jacobs and Langendoen's "Modern Compiler Design", consult Muchnick's "Advanced Compiler Design and Implementation".)
Topic-wise, supplemental material to Wirth's CC-book, I suggest: LR-parsing (yacc) and in-depth study of instruction selection ([i]burg) and register-allocation (graph coloring) for important backend optimizations. I think that gives a firm understanding of compilers, suitable for further study (such as Muchnick "Advanced Compiler Design and Implemetation" 1997 or Morgan "Building an Optimizing Compiler" 1998.)
I recommend starting with the Wirth book, then Andrew Appel's _Modern Compiler Implementation in ML_. And don't forget about the exercises!
The Go compilers are very fast. For most of the code I've developed (several hundred lines per package) I rarely have to wait more than 0.1 seconds to compile and link on my 2.4GHz i5.
Keep in mind that a lot of the logic is shared between backends, so check out http://code.google.com/p/go/source/browse/src/cmd/gc for the core stuff too.
I've just started reading this book, (older edition), after reading many recommendations that it would be a good place to start for beginners. I find it is an enjoyable read, but I don't really feel like I'm learning how to write a compiler. Much of the text seems devoted to the experience of wrestling with the restrictions of the technology of the day, (e.g. compile times were 12-24 hours because they had to wait for tapes generated by one half of the compiler at one location to be couriered to another location to be finished). I find this fascinating, but it's not really helping me learn to write a compiler. On top of that the solution and code is very close to the metal, which again I find to be fascinating but not incredibly educational.
I want to write a templating language in Haskell as an exercise to learn Haskell and get my feet wet with compilers. What's a good book for me?
http://www.pragprog.com/titles/tpdsl/language-implementation...
BTW, why not getting that @ amazon? At least you get 20% of in the US (but only get the book by March)
(The worst plug here for my own amazon link, you are warned, please don't vote this down just for the link: http://amzn.to/fpNazO)
You'd be surprised at the similarity between a JIT compiler and a static compiler with profiler feedback. Much of the optimizations are the same, and a lot of the code generation is the same. In fact, the biggest difference is just that there's a VM for jitted languages, but just a runtime for (most of) the static languages.
I will say however, that this book looks pretty decent, looking through the table of contents shows that it's not missing that many optimization concepts and is a good start for understanding how your compiler (JIT or otherwise) works. Understanding how your compiler works is a big step towards mastering a language.
Compiler design I think will always be a vital field. The LLVM project I think shows the direction we are headed - with more and more detailed bytecode to allow for better optimization before a 2nd pass compiles down to machine code.