|
Chapter 1 Introduction to Compiling |
|
|
1 | (24) |
|
|
1 | (3) |
|
1.2 Analysis of the source program |
|
|
4 | (6) |
|
1.3 The phases of a compiler |
|
|
10 | (6) |
|
1.4 Cousins of the compiler |
|
|
16 | (4) |
|
1.5 The grouping of phases |
|
|
20 | (2) |
|
1.6 Compiler-construction tools |
|
|
22 | (1) |
|
|
23 | (2) |
|
Chapter 2 A Simple One-Pass Compiler |
|
|
25 | (58) |
|
|
25 | (1) |
|
|
26 | (7) |
|
2.3 Syntax-directed translation |
|
|
33 | (7) |
|
|
40 | (8) |
|
2.5 A translator for simple expressions |
|
|
48 | (6) |
|
|
54 | (6) |
|
2.7 Incorporating a symbol table |
|
|
60 | (2) |
|
2.8 Abstract stack machines |
|
|
62 | (7) |
|
2.9 Putting the techniques together |
|
|
69 | (9) |
|
|
78 | (3) |
|
|
81 | (2) |
|
Chapter 3 Lexical Analysis |
|
|
83 | (76) |
|
3.1 The role of the lexical analyzer |
|
|
84 | (4) |
|
|
88 | (4) |
|
3.3 Specification of tokens |
|
|
92 | (6) |
|
3.4 Recognition of tokens |
|
|
98 | (7) |
|
3.5 A language for specifying lexical analyzers |
|
|
105 | (8) |
|
|
113 | (8) |
|
3.7 From a regular expression to an NFA |
|
|
121 | (7) |
|
3.8 Design of a lexical analyzer generator |
|
|
128 | (6) |
|
3.9 Optimization of DFA-based pattern matchers |
|
|
134 | (12) |
|
|
146 | (11) |
|
|
157 | (2) |
|
Chapter 4 Syntax Analysis |
|
|
159 | (120) |
|
4.1 The role of the parser |
|
|
160 | (5) |
|
4.2 Context-free grammars |
|
|
165 | (7) |
|
|
172 | (9) |
|
|
181 | (14) |
|
|
195 | (8) |
|
4.6 Operator-precedence parsing |
|
|
203 | (12) |
|
|
215 | (32) |
|
4.8 Using ambiguous grammars |
|
|
247 | (10) |
|
|
257 | (10) |
|
|
267 | (10) |
|
|
277 | (2) |
|
Chapter 5 Syntax-Directed Translation |
|
|
279 | (64) |
|
5.1 Syntax-directed definitions |
|
|
280 | (7) |
|
5.2 Construction of syntax trees |
|
|
287 | (6) |
|
5.3 Bottom-up evaluation of S-attributed definitions |
|
|
293 | (3) |
|
5.4 L-attributed definitions |
|
|
296 | (6) |
|
|
302 | (6) |
|
5.6 Bottom-up evaluation of inherited attributes |
|
|
308 | (8) |
|
|
316 | (4) |
|
5.8 Space for attribute values at compile time |
|
|
320 | (3) |
|
5.9 Assigning space at compiler-construction time |
|
|
323 | (6) |
|
5.10 Analysis of syntax-directed definitions |
|
|
329 | (7) |
|
|
336 | (4) |
|
|
340 | (3) |
|
|
343 | (46) |
|
|
344 | (4) |
|
6.2 Specification of a simple type checker |
|
|
348 | (4) |
|
6.3 Equivalence of type expressions |
|
|
352 | (7) |
|
|
359 | (2) |
|
6.5 Overloading of functions and operators |
|
|
361 | (3) |
|
6.6 Polymorphic functions |
|
|
364 | (12) |
|
6.7 An algorithm for unification |
|
|
376 | (5) |
|
|
381 | (5) |
|
|
386 | (3) |
|
Chapter 7 Run-Time Environments |
|
|
389 | (74) |
|
7.1 Source language issues |
|
|
389 | (7) |
|
|
396 | (5) |
|
7.3 Storage-allocation strategies |
|
|
401 | (10) |
|
7.4 Access to nonlocal names |
|
|
411 | (13) |
|
|
424 | (5) |
|
|
429 | (11) |
|
7.7 Language facilities for dynamic storage allocation |
|
|
440 | (2) |
|
7.8 Dynamic storage allocation techniques |
|
|
442 | (4) |
|
7.9 Storage allocation in Fortran |
|
|
446 | (9) |
|
|
455 | (6) |
|
|
461 | (2) |
|
Chapter 8 Intermediate Code Generation |
|
|
463 | (50) |
|
8.1 Intermediate languages |
|
|
464 | (9) |
|
|
473 | (5) |
|
8.3 Assignment statements |
|
|
478 | (10) |
|
|
488 | (9) |
|
|
497 | (3) |
|
|
500 | (6) |
|
|
506 | (2) |
|
|
508 | (3) |
|
|
511 | (2) |
|
Chapter 9 Code Generation |
|
|
513 | (72) |
|
9.1 Issues in the design of a code generator |
|
|
514 | (5) |
|
|
519 | (3) |
|
9.3 Run-time storage management |
|
|
522 | (6) |
|
9.4 Basic blocks and flow graphs |
|
|
528 | (6) |
|
|
534 | (1) |
|
9.6 A simple code generator |
|
|
535 | (6) |
|
9.7 Register allocation and assignment |
|
|
541 | (5) |
|
9.8 The dag representation of basic blocks |
|
|
546 | (8) |
|
9.9 Peephole optimization |
|
|
554 | (3) |
|
9.10 Generating code from dags |
|
|
557 | (10) |
|
9.11 Dynamic programming code-generation algorithm |
|
|
567 | (5) |
|
9.12 Code-generator generators |
|
|
572 | (8) |
|
|
580 | (3) |
|
|
583 | (2) |
|
Chapter 10 Code Optimization |
|
|
585 | (138) |
|
|
586 | (6) |
|
10.2 The principal sources of optimization |
|
|
592 | (6) |
|
10.3 Optimization of basic blocks |
|
|
598 | (4) |
|
10.4 Loops in flow graphs |
|
|
602 | (6) |
|
10.5 Introduction to global data-flow analysis |
|
|
608 | (16) |
|
10.6 Iterative solution of data-flow equations |
|
|
624 | (9) |
|
10.7 Code-improving transformations |
|
|
633 | (15) |
|
10.8 Dealing with aliases |
|
|
648 | (12) |
|
10.9 Data-flow analysis of structured flow graphs |
|
|
660 | (11) |
|
10.10 Efficient data-flow algorithms |
|
|
671 | (9) |
|
10.11 A tool for data-flow analysis |
|
|
680 | (14) |
|
10.12 Estimation of types |
|
|
694 | (9) |
|
10.13 Symbolic debugging of optimized code |
|
|
703 | (8) |
|
|
711 | (7) |
|
|
718 | (5) |
|
Chapter 11 Want to Write a Compiler? |
|
|
723 | (10) |
|
|
723 | (2) |
|
11.2 Approaches to compiler development |
|
|
725 | (4) |
|
11.3 The compiler-development environment |
|
|
729 | (2) |
|
11.4 Testing and maintenance |
|
|
731 | (2) |
|
Chapter 12 A Look at Some Compilers |
|
|
733 | (12) |
|
12.1 EQN, a preprocessor for typesetting mathematics |
|
|
733 | (1) |
|
12.2 Compilers for Pascal |
|
|
734 | (1) |
|
|
735 | (2) |
|
12.4 The Fortran H compilers |
|
|
737 | (3) |
|
12.5 The Bliss/11 compiler |
|
|
740 | (2) |
|
12.6 Modula-2 optimizing compiler |
|
|
742 | (3) |
|
Appendix A Compiler Project |
|
|
745 | (7) |
|
|
745 | (1) |
|
|
745 | (1) |
|
|
745 | (3) |
|
|
748 | (1) |
|
|
749 | (1) |
|
A.6 Evolution of the interpreter |
|
|
750 | (1) |
|
|
751 | (1) |
Bibliography |
|
752 | (28) |
Index |
|
780 | |