Cover
Compiler Design
Preface
Acknowledgments
Contents
1 Introduction
1.1 High-Level Programming Languages
1.2 Implementation of Programming Languages
1.2.1 Interpreters
1.2.2 Compilers
1.2.3 Real and Virtual Machines
1.2.4 Combined Compilation and Interpretation
1.3 General References
2 Imperative Programming Languages
2.1 Language Concepts and Their Compilation
2.2 The Architecture of the C-Machine
2.3 Simple Expressions and Assignments
2.4 Statements and Statement Sequences
2.5 Conditional and Iterative Statements
2.6 Memory Allocation for Variables of Basic Types
2.7 Memory Allocation for Arrays and Structures
2.8 Pointers and Dynamic Memory Allocation
2.9 Functions
2.9.1 Memory Organization of the C-Machine
2.9.2 Dealing with Local Variables
2.9.3 Function Call and Return
2.10 Translation of Programs
2.11 Exercises
2.12 List of CMa Registers
2.13 List of Code Functions of the CMa
2.14 List of CMa Instructions
2.15 References
3 Functional Programming Languages
3.1 Basic Concepts and Introductory Examples
3.2 A Simple Functional Programming Language
3.3 The Architecture of the MaMa
3.4 Translation of Simple Expressions
3.5 Access to Variables
3.6 let Expressions
3.7 Function Definitions
3.8 Function Application
3.9 Under- and Oversupply with Arguments
3.10 Recursive Variable Definitions
3.11 Closures and Their Evaluation
3.12 Optimization I: Global Variables
3.13 Optimization II: Closures
3.14 Translating Program Expressions
3.15 Structured Data
3.15.1 Tuples
3.15.2 Lists
3.15.3 Closures for Tuples and Lists
3.16 Optimization III: Last Calls
3.17 Exercises
3.18 List of MaMa Registers
3.19 List of Code Functions of the MaMa
3.20 List of MaMa Instructions
3.21 References
4 Logic Programming Languages
4.1 The Language ProL
4.2 The Architecture of the WiM
4.3 Allocation of Terms in the Heap
4.4 The Translation of Literals
4.5 Unification
4.6 Clauses
4.7 The Translation of Predicates
4.7.1 Backtracking
4.7.2 Putting It All Together
4.8 The Finalization of Clauses
4.9 Queries and Programs
4.10 Optimization I: Last Goals
4.11 Optimization II: Trimming of Stack Frames
4.12 Optimization III: Clause Indexing
4.13 Extension: The Cut Operator
4.14 Digression: Garbage Collection
4.15 Exercises
4.16 List of WiM Registers
4.17 List of Code Functions of the WiM
4.18 List of WiM Instructions
4.19 References
5 Object-Oriented Programming Languages
5.1 Concepts of Object-Oriented Languages
5.1.1 Objects
5.1.2 Object Classes
5.1.3 Inheritance
5.1.4 Genericity
5.1.5 Information Encapsulation
5.1.6 Summary
5.2 An Object-Oriented Extension of C
5.3 The Memory Organization for Objects
5.4 Method Calls
5.5 The Definition of Methods
5.6 The Use of Constructors
5.7 The Definition of Constructors
5.8 Perspective: Multiple Inheritance
5.9 Exercises
5.10 List of Additional Registers
5.11 CMa Instructions for Objects
5.12 References
References
Index