Preface
Table of Contents
Chapter 1 Introduction
1.1 What is a Compiler?
1.2 The Phases of a Compiler
1.3 Implementation Techniques
1.4 Case Study: MiniC
1.5 Chapter Summary
Chapter 2 Lexical Analysis
2.0 Formal Languages
2.1 Lexical Tokens
2.2 Implementation with Finite State Machines
2.3 Lexical Tables
2.4 Lex
2.5 Case Study: Lexical Analysis for MiniC
2.6 Chapter Summary
Chapter 3 Syntax Analysis
3.0 Grammars, Languages, and Pushdown Machines
3.1 Ambiguities in Programming Languages
3.2 The Parsing Problem
3.3 Chapter Summary
Chapter 4 Top Down Parsing
4.0 Relations and Closure
4.1 Simple Grammars
4.2 Quasi-Simple Grammars
4.3 LL(1) Grammars
4.4 Parsing Arithmetic Expressions Top Down
4.5 Syntax-Directed Translation
4.6 Attributed Grammars
4.7 An Attributed Translation Grammar for Expressions
4.8 MiniC Expressions
4.9 Translating Control Structures
4.10 Case Study: A Top Down Parser for MiniC
4.11 Chapter Summary
Chapter 5 Bottom Up Parsing
5.1 Shift Reduce Parsing
5.2 LR Parsing With Tables
5.3 Yacc
5.4 Arrays
5.5 Case Study: Syntax Analysis for MiniC
5.6 Chapter Summary
Chapter 6 Code Generation
6.1 Introduction to Code Generation
6.2 Converting Atoms to Instructions
6.3 Single Pass vs. Multiple Passes
6.4 Register Allocation
6.5 Case Study: A MiniC Code Generator for the Mini Architecture
6.6 Chapter Summary
Chapter 7 Optimization
7.1 Introduction and View of Optimization
7.2 Global Optimization
7.3 Local Optimization
7.4 Chapter Summary
Glossary
Appendix A MiniC Grammar
Appendix B MiniC Compiler
B.1 Software Files
B.2 Lexicall Phase
B.3 Syntax Analysis
B.4 Code Generator
Appendix C Mini Simulator
Bibliography
Index
· · · · · · (
收起)