Crafting A Compiler
Inbunden, Engelska, 2010
3 069 kr
Crafting a Compiler is a practical yet thorough treatment of compiler construction. It is ideal for undergraduate courses in Compilers or for software engineers, systems analysts, and software architects.
Crafting a Compiler is an undergraduate-level text that presents a practical approach to compiler construction with thorough coverage of the material and examples that clearly illustrate the concepts in the book. Unlike other texts on the market, Fischer/Cytron/LeBlanc uses object-oriented design patterns and incorporates an algorithmic exposition with modern software practices. The text and its package of accompanying resources allow any instructor to teach a thorough and compelling course in compiler construction in a single semester. It is an ideal reference and tutorial for students, software engineers, systems analysts, and software architects.
Produktinformation
- Utgivningsdatum2010-01-19
- Mått194 x 240 x 43 mm
- Vikt1 390 g
- FormatInbunden
- SpråkEngelska
- Antal sidor720
- Upplaga1
- FörlagPearson Education
- ISBN9780136067054
Tillhör följande kategorier
- Chapter 1 Introduction1.1 Overview and History of Compilation 1.2 What Compilers Do1.2.1 Distinguishing Compilers by the Machine Code Generated1.2.2 Target Code Formats1.3 Interpreters1.4 Syntax and Semantics of Programming Languages1.4.1 Static Semantics1.4.2 Run-time Semantics1.5 Organization of a Compiler1.5.1 The Scanner1.5.2 The Parser1.5.3 The Type Checker (Semantic Analysis)1.5.4 The Optimizer1.5.5 The Code Generator1.5.6 Compiler Writing Tools1.6 Compiler Design and Programming Language Design1.7 Architectural Influences of Computer Design1.8 Compiler Variants1.8.1 Debugging (Development) Compilers1.8.2 Optimizing Compilers1.8.3 Retargetable Compilers1.9 Program Development EnvironmentChapter 2 A Simple Compiler2.1 An Informal Definition of the ac Language2.2 Formal Definition of ac2.2.1 Syntax Specification2.2.2 Token Specification2.3 Phases of a Simple Compiler2.4 Scanning2.5 Parsing2.5.1 Predicting a Parsing Procedure2.5.2 Implementing the Production2.6 Abstract Syntax Trees2.7 Semantic Analysis2.7.1 Symbol Tables2.7.2 Type Checking2.8 Code GenerationChapter 3 Scanning–Theory and Practice3.1 Overview of a Scanner3.2 Regular Expressions3.3 Examples3.4 Finite Automata and Scanners3.4.1 Deterministic Finite Automata3.5 The Lex Scanner Generator3.5.1 Defining Tokens in Lex3.5.2 The Character Class3.5.3 Using Regular Expressions to Define Tokens3.5.4 Character Processing Using Lex3.6 Other Scanner Generators3.7 Practical Considerations of Building Scanners3.7.1 Processing Identifiers and Literals3.7.2 Using Compiler Directives and Listing Source Lines3.7.3 Terminating the Scanner3.7.4 Multicharacter Lookahead3.7.5 Performance Considerations3.7.6 Lexical Error Recovery3.8 Regular Expressions and Finite Automata3.8.1 Transforming a Regular Expression into an NFA3.8.2 Creating the DFA3.8.3 Optimizing Finite Automata3.9 SummaryChapter 4 Grammars and Parsing4.1 Context-Free Grammars: Concepts and Notation4.1.1 Leftmost Derivations4.1.2 Rightmost Derivations4.1.3 Parse Trees4.1.4 Other Types of Grammars4.2 Properties of CFGs4.2.1 Reduced Grammars4.2.2 Ambiguity4.2.3 Faulty Language Definition4.3 Transforming Extended Grammars4.4 Parsers and Recognizers4.5 Grammar Analysis Algorithms4.5.1 Grammar Representation4.5.2 Deriving the Empty String4.5.3 First Sets4.5.4 Follow SetsChapter 5 Top-Down Parsing5.1 Overview5.2 LL(k) Grammars5.3 Recursive-Descent LL(1) parsers5.4 Table-Driven LL(1) Parsers5.5 Obtaining LL(1) Grammars5.5.1 Common Prefixes5.5.2 Left-Recursion5.6 A Non-LL(1) Language5.7 Properties of LL(1) Parsers5.8 Parse-Table Representation5.8.1 Compaction5.8.2 Compression5.9 Syntactic Error Recovery and Repair5.9.1 Error Recover5.9.2 Error Repair5.9.3 Error Detection in LL(1) Parsers5.9.4 Error Recovery in LL(1) ParsersChapter 6 Bottom-Up Parsing6.1 Introduction6.2 Shift-Reduce Parsers6.2.1 LR Parsers and Rightmost Derivations6.2.2 LR Parsing as Knitting6.2.3 LR Parsing Engine6.2.4 The LR Parse Table6.2.5 LR(k) Parsing6.3 LR(0) Table Construction6.4 Conflict Diagnosis6.4.1 Ambiguous Grammars6.4.2 Grammars that are not LR(k)6.5 Conflict Resolution for LR(0) Tables6.5.1 SLR(k) Table Construction6.5.2 LALR(k) Table Construction6.6 LR(k) Table ConstructionChapter 7 Syntax-Directed Translation7.1 Overview7.1.1 Semantic Actions and Values7.1.2 Synthesized and Inherited Attributes7.2 Bottom-Up Syntax-Directed Translation7.2.1 Example7.2.2 Rule Cloning7.2.3 Forcing Semantic Actions7.2.4 Aggressive Grammar Restructuring7.3 Top-Down Syntax-Directed Translation7.4 Abstract Syntax Trees7.4.1 Concrete and Abstract Trees7.4.2 An Efficient AST Data Structure7.4.3 Infrastructure for Creating ASTs7.5 AST Design and Construction7.5.1 Design7.5.2 Construction7.6 AST Structures for Left and Right Values7.7 Design Patterns for ASTs7.7.1 Node Class Hierarchy7.7.2 Visitor Pattern7.7.3 Reflective Visitor PatternChapter 8 Symbol Tables and Declaration Processing8.1 Constructing a Symbol Table8.1.1 Static Scoping8.1.2 A Symbol Table Interface8.2 Block-Structured Languages and Scope Management8.2.1 Handling Scopes8.2.2 One Symbol Table or Many?8.3 Basic Implementation Techniques8.3.1 Entering and Finding Names8.3.2 The Name Space8.3.3 An Efficient Symbol Table Implementation8.4 Advanced Features8.4.1 Records and Typenames8.4.2 Overloading and Type Hierarchies 8.4.3 Implicit Declarations8.4.4 Export and Import Directives8.4.5 Altered Search Rules8.5 Declaration Processing Fundamentals8.5.1 Attributes in the Symbol Table8.5.2 Type Descriptor Structures8.5.3 Type Checking Using an Abstract Syntax Tree8.6 Semantic Processing of Simple Declarations8.6.1 Simple Variable Declarations8.6.2 Handling Type Names8.6.3 Name References8.6.4 Type Declarations and References8.6.5 Variable Declarations Revisited8.6.6 Enumeration Types8.7 Semantic Processing for Simple Names and Expressions: An Introduction to Type Checking8.7.1 Handling Simple Identifiers and and Literal Constants8.7.2 Processing Expressions8.8 Type Declarations8.9 Static and Dynamic Allocation8.9.1 Initialization of Variables8.9.2 Constant Declarations8.10 Classes and Structures8.10.1 Variant Records and Unions8.11 Arrays8.11.1 Static One-Dimensional Arrays8.11.2 Multidimensional Arrays8.12 Implementing Other Types8.13 Key Idea SummaryChapter 9 Expressions and Type Checking9.1 Semantic Analysis for Control Structures9.1.1 If Statements9.1.2 While, Do and Repeat Loops9.1.3 For Loops9.1.4 Break, Continue, Return and Goto Statements9.1.5 Switch and Case Statements9.1.6 Exception Handling9.2 Semantic Analysis of CallsChapter 10 Intermediate Representations10.1 Overview10.1.1 Examples10.1.2 The Middle End10.2 Java Virtual Machine10.2.1 Introduction and Design Principles10.2.2 Contents of a Class File10.2.3 JVM Instructions10.3 Static Single Assignment Form10.3.1 Renaming and --functions10.4 GCC ILsChapter 11 Code Generation for a Virtual Machine11.1 Visitors for Code Generation11.2 Class and Method Declarations11.2.1 Class Declarations11.2.2 Method Declarations11.3 The MethodBodyVisitor11.3.1 Constants11.3.2 References to Local Storage11.3.3 Static References11.3.4 Expressions11.3.5 Assignment11.3.6 Method Calls11.3.7 Field References11.3.8 Conditional Execution11.3.9 Loops11.4 The LHSVisitor11.4.1 Local References11.4.2 Static References11.4.3 Field ReferencesChapter 12 Runtime Support12.1 Static Allocation12.2 Stack Allocation12.2.1 Accessing Frames at Run-Time12.2.2 Handling Classes and Objects12.2.3 Handling Multiple Scopes12.2.4 Block-Level Allocation12.2.5 More About Frames12.3 Heap Management12.3.1 Allocation Mechanisms12.3.2 Deallocation Mechanisms12.3.3 Automatic Garbage CollectionChapter 13 Target Code Generation13.1 Translating Bytecodes13.1.1 Allocating memory addresses13.1.2 Allocating Arrays and Objects13.1.3 Method Calls13.1.4 Example13.2 Translating Expression Trees13.3 Register Allocation and Temporary Management13.3.1 On the Fly Register Allocation13.3.2 Register Allocation Using Graph Coloring13.3.3 Priority Based Register Allocation13.3.4 Interprocedural Register Allocation13.4 Code Scheduling13.4.1 Improving Code Scheduling13.4.2 Global and Dynamic Code Scheduling13.5 Automatic Instruction Selection13.5.1 Instruction Selection Using BURS13.5.2 Instruction Selection Using Twig13.5.3 Other Approaches13.6 Peephole Optimization13.6.1 Levels of Peephole Optimization13.6.2 Automatic Generation of Peephole OptimizersChapter 14 Program Optimization 50514.1 Introduction14.1.1 Why Optimize?14.1.2 Organization14.2 Data Flow Analysis14.2.1 Introduction and Examples14.2.2 Formal Specification14.2.3 Evaluation WARNING this subsection is incomplete14.2.4 Application of Data Flow Frameworks14.3 Advanced Optimizations14.3.1 SSA Form14.3.2 SSA-based Transformations14.3.3 Loop TransformationsAbbreviationsIndex