Compilers Second Edition [0]
Engineering a Compiler, Second Edition [1]
Computer Systems: A Programmer's Perspective (3rd Edition) [2]
[0]https://www.amazon.com/Compilers-Principles-Techniques-Alfre... [1]https://www.amazon.com/Engineering-Compiler-Second-Keith-Coo... [2]https://www.amazon.com/Computer-Systems-Programmers-Perspect...
* Engineering a Compiler: https://www.amazon.com/Engineering-Compiler-Second-Keith-Coo...
* Modern Compiler Implementation in ML: https://www.cs.princeton.edu/~appel/modern/ml/
* Compiling with Continuations: https://www.amazon.com/Compiling-Continuations-Andrew-W-Appe...
I have always really enjoyed just reading the source code for programming languages. As I learn more and more, I seem to take away a bit more each time.
Personally I've enjoyed reading through the source code for Go, since it is hand written in Go. Being hand written, it can be a little repetition reading through it, but I find it to be pretty easier to read/understand.
https://github.com/golang/go/tree/release-branch.go1.6/src/g...
Also, I have read (at least parts of) the book, "Engineering a Compiler", which being a novice in the subject, some of it goes over my head, but I think it does a better job outlining the topic than any other books I have read.
https://www.amazon.com/Engineering-Compiler-Second-Keith-Coo...
Enjoy :)
Corresponding lecture notes: https://www.clear.rice.edu/comp412/Lectures.
Your advice is great in general, but I wish people would back up statements like this with some context, for example, what specifically have you compared it with? Inspired by Steve Yegge blogposts I once decided to write a toy compiler for educational purposes and I started with reading the Dragon Book, in fact I eventually read it almost cover to cover and implemented many algorithms from it, it is definitely full of valuable information. But it also is a very roundabout way of learning how to write an actual compiler, it is more a theoretical reference work than anything else. There are several hundreds of pages devoted to parsing, but some of the more modern techniques are not covered, runtime is treated much more briefly and many practical issues are not discussed at all. There are some nice modern textbooks that are more to the point:
http://www.amazon.com/Modern-Compiler-Design-D-Grune/dp/0471... http://www.amazon.com/Engineering-Compiler-Second-Keith-Coop...
ANTLR is a great tool and many practical issues I solved with the help of this book about it:
http://www.amazon.com/gp/product/1934356999/
Finally, source code of original AWK is a great example codebase to learn about real-world parsing, building and traversing parse trees etc.:
https://github.com/danfuzz/one-true-awk
It is an interpreter and not a compiler but once you know how to do the things just mentioned converting it to a naive compiler isn't that hard if you are not interested in fancy optimization like the OP said.
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)