Book contents
- Frontmatter
- Contents
- Preface
- Part I Fundamentals of Compilation
- 1 Introduction
- 2 Lexical Analysis
- 3 Parsing
- 4 Abstract Syntax
- 5 Semantic Analysis
- 6 Activation Records
- 7 Translation to Intermediate Code
- 8 Basic Blocks and Traces
- 9 Instruction Selection
- 10 Liveness Analysis
- 11 Register Allocation
- 12 Putting It All Together
- Part II Advanced Topics
- Appendix: MiniJava Language Reference Manual
- Bibliography
- Index
1 - Introduction
from Part I - Fundamentals of Compilation
Published online by Cambridge University Press: 05 June 2012
- Frontmatter
- Contents
- Preface
- Part I Fundamentals of Compilation
- 1 Introduction
- 2 Lexical Analysis
- 3 Parsing
- 4 Abstract Syntax
- 5 Semantic Analysis
- 6 Activation Records
- 7 Translation to Intermediate Code
- 8 Basic Blocks and Traces
- 9 Instruction Selection
- 10 Liveness Analysis
- 11 Register Allocation
- 12 Putting It All Together
- Part II Advanced Topics
- Appendix: MiniJava Language Reference Manual
- Bibliography
- Index
Summary
A compiler was originally a program that “compiled” subroutines [a link-loader]. When in 1954 the combination “algebraic compiler” came into use, or rather into misuse, the meaning of the term had already shifted into the present one.
Bauer and Eickel [1975]This book describes techniques, data structures, and algorithms for translating programming languages into executable code. A modern compiler is often organized into many phases, each operating on a different abstract “language.” The chapters of this book follow the organization of a compiler, each covering a successive phase.
To illustrate the issues in compiling real programming languages, we show how to compile MiniJava, a simple but nontrivial subset of Java. Programming exercises in each chapter call for the implementation of the corresponding phase; a student who implements all the phases described in Part I of the book will have a working compiler. MiniJava is easily extended to support class extension or higher-order functions, and exercises in Part II show how to do this. Other chapters in Part II cover advanced techniques in program optimization. Appendix A describes the MiniJava language.
The interfaces between modules of the compiler are almost as important as the algorithms inside the modules. To describe the interfaces concretely, it is useful to write them down in a real programming language. This book uses Java – a simple object-oriented language. Java is safe, in that programs cannot circumvent the type system to violate abstractions; and it has garbage collection, which greatly simplifies the management of dynamic storage allocation.
- Type
- Chapter
- Information
- Modern Compiler Implementation in Java , pp. 3 - 15Publisher: Cambridge University PressPrint publication year: 2002