The new, expanded version of this textbook describes all phases of a modern compiler. It includes good coverage of current techniques in code generation and register allocation, as well as functional and object-oriented languages, that is missing from most books. It features new advanced chapters covering SSA form, loop scheduling, and optimization for cache-memory hierarchies, which make it suitable for a two-semester or graduate course. The most accepted and successful techniques are described in a concise way, rather than as an exhaustive catalog of every possible variant. Detailed descriptions of the interfaces between modules of a compiler are illustrated with C header files. A unique feature of the book is a well designed compiler implementation project in Java, including front-end and Ohigh-techO back-end phases, so that students can build a complete working compiler in one semester.Accompanying support software is available.