People ask "how do I learn compilers" in some form or other every few weeks. Someone immediately replies "read the dragon book". This is very bad advice for a compiler newbie (see discussion)
If you find yourself in this position, please recommend "Engineering a Compiler" by Keith Cooper/Linda Torczon, or "Modern Compiler Implementation in X" (where X should probably be Java, maybe C), by Andrew Appel. These are excellent introductions to compiler for beginners.
Please also vote down answers where the answerer says only "read the Dragon Book", without a qualifying remark.
Discussion:
The Dragon Book is a very thorough book, with detailed discussion of theory (especially about parsing). However, this level of detail and theory does not make it a good introductory book. In contrast, the books above present very clearly how to build a compiler, avoiding theory where it is not useful. This makes them superior recommendations for beginners.
The Dragon Book is best suggested for intermediate compiler authors, though they are likely to know of it already.
Partial list of questions so answered
- How to create a compiler in vb.net
- Learning Resources on Parsers, Interpreters, and Compilers
- https://stackoverflow.com/questions/411682/introduction-to-static-analysis
- https://stackoverflow.com/questions/1156363/create-a-compiler-for-windows
- Compilers and beyond
- Suggestions for writing a programming language?
- Interesting compiler projects
- https://stackoverflow.com/questions/10216/what-are-the-best-resources-on-designing-a-new-language
- What is the good approach to build a new compiler?
- Bootstrapping a language
- What happens when I compile?
- Compiler design resources
- Need Help Understanding Compilers/HLL->Assembly
- Unable to understand compilers' main optimizations
- How do C/C++ compilers work?
- https://stackoverflow.com/questions/424796/are-there-any-compiler-lectures-available-via-video
- Learning how programming languages work
- https://stackoverflow.com/questions/1177652/taking-a-compilation-course-in-undergraduate-cs-studies-useful