Table of Contents

1. Introduction
Literate Programs. How to Read This Book. Overview. Design. Common Declarations. Syntax Specifications. Errors.
2. Storage Management
Memory Management Interface. Arena Representation. Allocating Space. Deallocating Space. Strings.
3. Symbol Management
Representing Symbols. Representing Symbol Tables. Changing Scope. Finding and Installing Identifiers. Labels. Constants. Generated Variables.
4. Types
Representing Types. Type Management. Type Predicates. Type Constructors. Function Types. Structure and Enumeration Types. Type-Checking Functions. Type Mapping.
5. Code Generation Interface
Type Metrics. Interface Records. Symbols. Types. Dag Operators. Interface Flags. Initialization. Definitions. Constants. Functions. Interface Binding. Upcalls.
6. Lexical Analysis
Input. Recognizing Tokens. Recognizing Keywords. Recognizing Identifiers. Recognizing Numbers. Recognizing Character Constants and Strings.
7. Parsing
Languages and Grammars. Ambiguity and Parse Trees. Top-Down Parsing. FIRST and FOLLOW Sets. Writing Parsing Functions. Handling Syntax Errors.
8. Expressions
Representing Expressions. Parsing Expressions. Parsing C Expressions. Assignment Expressions. Conditional Expressions. Binary Expressions. Unary and Postfix Expressions. Primary Expressions.
9. Expression Semantics
Conversions. Unary and Postfix Operators. Function Calls. Binary Operators. Assignments. Conditionals. Constant Folding.
10. Statements
Representing Code. Execution Points. Recognizing Statements. If Statements. Labels and Gotos. Loops. Switch Statements. Return Statements. Managing Labels and Jumps.
11. Declarations
Translation Units. Declarations. Declarators. Function Declarators. Structure Specifiers. Function Definitions. Compound Statements. Finalization. The Main Program.
12. Generating Intermediate Code
Eliminating Common Subexpressions. Building Nodes. Flow of Control. Assignments. Function Calls. Enforcing Evaluation Order. Driving Code Generation. Eliminating Multiply Referenced Nodes.
13. Structuring the Code Generator
Organization of the Code Generator. Interface Extensions. Upcalls. Node Extensions. Symbol Extensions. Frame Layout. Generating Code to Copy Blocks. Initialization.
14. Selecting and Emitting Instructions
Specifications. Labelling the Tree. Reducing the Tree. Cost Functions. Debugging. The Emitter. Register Targeting. Coordinating Instruction Selection. Shared Rules.
15. Register Allocation
Organization. Tracking the Register State. Allocating Registers. Spilling.
16. Generating MIPS R3000 Code
Registers. Selecting Instructions. Implementing Functions. Defining Data. Segments. Copying Blocks.
17. Generating SPARC Code
Registers. Selecting Instructions. Implementing Functions. Defining Data. Copying Blocks.
18. Generating Intel X86 Code
Registers. Selecting Instructions. Implementing Functions. Defining Data.
19. Retrospective
Data Structures. Interface. Syntactic and Semantic Analyses. Code Generation and Optimization. Testing and Validation.

Chris Fraser ยท David Hanson