The second edition features a redesigned compiler project in Java, for a subset of Java itself.This textbook describes all phases of a compiler. It includes good coverage of current techniques in code generation and register allocation, as well as the compilation of functional and object-oriented languages, that is missing from most books. Advanced chapters cover SSA form, loop scheduling, and optimization for cache-memory hierarchies. The most accepted and successful techniques are described in a concise way and illustrated with actual Java classes. This new edition includes more discussion of Java and object-oriented programming concepts such as visitor patterns plus a new Mini-Java programming project. A unique feature is the newly redesigned compiler project in Java, for a subset of Java itself. The project includes both front-end and back-end phases, so that students can build a complete working compiler in one semester.This textbook describes all phases of a compiler. It includes good coverage of current techniques in code generation and register allocation, as well as the compilation of functional and object-oriented languages, that is missing from most books. Advanced chapters cover SSA form, loop scheduling, and optimization for cache-memory hierarchies. The most accepted and successful techniques are described in a concise way and illustrated with actual Java classes. This new edition includes more discussion of Java and object-oriented programming concepts such as visitor patterns plus a new Mini-Java programming project. A unique feature is the newly redesigned compiler project in Java, for a subset of Java itself. The project includes both front-end and back-end phases, so that students can build a complete working compiler in one semester.This textbook describes all phases of a compiler: lexical analysis, parsing, abstract syntax, semantic actions, intermediate representations, instruction selection via tree matching, dataflow analysis, graph-cló²