You are previewing Engineering a Compiler.
O'Reilly logo
Engineering a Compiler

Book Description

This entirely revised second edition of Engineering a Compiler is full of technical updates and new material covering the latest developments in compiler technology. In this comprehensive text you will learn important techniques for constructing a modern compiler. Leading educators and researchers Keith Cooper and Linda Torczon combine basic principles with pragmatic insights from their experience building state-of-the-art compilers. They will help you fully understand important techniques such as compilation of imperative and object-oriented languages, construction of static single assignment forms, instruction scheduling, and graph-coloring register allocation.



  • In-depth treatment of algorithms and techniques used in the front end of a modern compiler
  • Focus on code optimization and code generation, the primary areas of recent research and development
  • Improvements in presentation including conceptual overviews for each chapter, summaries and review questions for sections, and prominent placement of definitions for new terms
  • Examples drawn from several different programming languages
  • Table of Contents

    1. Cover image
    2. Table of Contents
    3. In Praise of Engineering a Compiler Second Edition
    4. Front Matter
    5. Copyright
    6. Dedication
    7. About the Authors
    8. About the Cover
    9. Preface to the Second Edition
    10. Chapter 1. Overview of Compilation
    11. 1.1. Introduction
    12. 1.2. Compiler Structure
    13. 1.3. Overview of Translation
    14. 1.4. Summary and Perspective
    15. Chapter 2. Scanners
    16. 2.1. Introduction
    17. 2.2. Recognizing Words
    18. 2.3. Regular Expressions
    19. 2.4. From Regular Expression to Scanner
    20. 2.5. Implementing Scanners
    21. 2.6. Advanced Topics
    22. 2.7. Chapter Summary and Perspective
    23. Chapter 3. Parsers
    24. 3.1. Introduction
    25. 3.2. Expressing Syntax
    26. 3.3. Top-Down Parsing
    27. 3.4. Bottom-Up Parsing
    28. 3.5. Practical Issues
    29. 3.6. Advanced Topics
    30. 3.7. Summary and Perspective
    31. Chapter 4. Context-Sensitive Analysis
    32. 4.1. Introduction
    33. 4.2. An Introduction to Type Systems
    34. 4.3. The Attribute-Grammar Framework
    35. 4.4. Ad Hoc Syntax-Directed Translation
    36. 4.5. Advanced Topics
    37. 4.6. Summary And Perspective
    38. Chapter 5. Intermediate Representations
    39. 5.1. Introduction
    40. 5.2. Graphical IRS
    41. 5.3. Linear IRS
    42. 5.4. Mapping Values to Names
    43. 5.5. Symbol Tables
    44. 5.6. Summary and Perspective
    45. Chapter 6. The Procedure Abstraction
    46. 6.1. Introduction
    47. 6.2. Procedure Calls
    48. 6.3. Name Spaces
    49. 6.4. Communicating Values Between Procedures
    50. 6.6. Advanced Topics
    51. 6.7. Summary and Perspective
    52. Chapter 7. Code Shape
    53. 7.1. Introduction
    54. 7.2. Assigning Storage Locations
    55. 7.3. Arithmetic Operators
    56. 7.4. Boolean and Relational Operators
    57. 7.5. Storing and Accessing Arrays
    58. 7.6. Character Strings
    59. 7.7. Structure References
    60. 7.8. Control-Flow Constructs
    61. 7.9. Procedure Calls
    62. 7.10. Summary and Perspective
    63. Chapter 8. Introduction to Optimization
    64. 8.1. Introduction
    65. 8.2. Background
    66. 8.3. Scope of Optimization
    67. 8.4. Local Optimization
    68. 8.5. Regional Optimization
    69. 8.6. Global Optimization
    70. 8.7. Interprocedural Optimization
    71. 8.8. Summary and Perspective
    72. Chapter 9. Data-Flow Analysis
    73. 9.1. Introduction
    74. 9.2. Iterative Data-Flow Analysis
    75. 9.3. Static Single-Assignment Form
    76. 9.4. Interprocedural Analysis
    77. 9.5. Advanced Topics
    78. 9.6. Summary and Perspective
    79. Chapter 10. Scalar Optimizations
    80. 10.1. Introduction
    81. 10.2. Eliminating Useless and Unreachable Code
    82. 10.3. Code Motion
    83. 10.4. Specialization
    84. 10.5. Redundancy Elimination
    85. 10.7. Advanced Topics
    86. 10.8. Summary and Perspective
    87. Chapter 11. Instruction Selection
    88. 11.1. Introduction
    89. 11.2. Code Generation
    90. 11.3. Extending the Simple Treewalk Scheme
    91. 11.4. Instruction Selection via Tree-Pattern Matching
    92. 11.5. Instruction Selection via Peephole Optimization
    93. 11.6. Advanced Topics
    94. 11.7. Summary and Perspective
    95. Chapter 12. Instruction Scheduling
    96. 12.1. Introduction
    97. 12.2. The Instruction-Scheduling Problem
    98. 12.3. Local List Scheduling
    99. 12.4. Regional Scheduling
    100. 12.5. Advanced Topics
    101. 12.6. Summary and Perspective
    102. Chapter 13. Register Allocation
    103. 13.1. Introduction
    104. 13.2. Background Issues
    105. 13.3. Local Register Allocation and Assignment
    106. 13.4. Global Register Allocation and Assignment
    107. 13.5. Advanced Topics
    108. 13.6. Summary and Perspective
    109. Appendix A. ILOC
    110. Appendix B. Data Structures
    111. Bibliography
    112. Index