Detailansicht

Compiler Construction Using Java, JavaCC, and Yacc

ISBN/EAN: 9780470949597
Umbreit-Nr.: 1709092

Sprache: Englisch
Umfang: XVII, 635 S.
Format in cm: 3.5 x 26 x 18.5
Einband: gebundenes Buch

Erschienen am 20.01.2012
Auflage: 1/2012
€ 119,00
(inklusive MwSt.)
Nachfragen
  • Zusatztext
    • A student-friendly, course-friendly guide to compiler theory, applications, and programming technology Compiler construction is a tricky subject, involving theory, the application of that theory, and programming technology. Virtually every day, advances in computer technology propel advances in compiler technology. Compiler Construction Using Java, JavaCC, and Yacc covers every topic essential to learning compilers from the ground up and is accompanied by a powerful and flexible software package for evaluating projects as well as several tutorials, well-defined projects, and test cases. While the coverage of JavaCC is entirely optional, this book provides the only comprehensive introduction to the topic currently available. Far easier to read and understand than any other compiler guide, this book sets a new standard for learning this invaluable skill. It provides: * Strong coverage of formal languages, including context-sensitive and unrestricted languages as well as regular and context-free languages * A clear exposition of compiler design and implementation theory * Numerous well-defined projects, using source language with six levels of complexity * A complete teaching support software package that evaluates compiler projects for correctness, run time, and size of code, and runs on multiple platforms * Immediate feedback for students on their projects Compiler Construction Using JavaTM, JavaCC, and Yacc provides substantial support for each project, many of which are incremental enhancements of previous projects. The goals at each new level are challenging but achievable and can be reached in several different ways, for example, by writing a compiler or interpreter by hand, with JavaCC, or with Yacc.
  • Autorenportrait
    • InhaltsangabePreface xv Chapter 1. Strings, Languages, and Compilers 1 1.1 Introduction 1 1.2 Basic Language Concepts 1 1.3 Basic Compiler Concepts 3 1.4 Basic Set Theory 4 1.5 Null String 6 1.6 Concatenation 7 1.7 Exponent Notation 7 1.8 Star Operator 8 1.9 Concatenation of Sets of Strings 9 1.10 Plus Operator 11 1.11 Question Mark Operator 11 1.12 Shorthand Notation for a Set Containing a Single String 12 1.13 Operator Precedence 12 1.14 Regular Expressions 13 1.15 Limitations of Regular Expressions 15 Problems 16 Chapter 2. Context-Free Grammars, Part 1 19 2.1 Introduction 19 2.2 What is a Context-Free Grammar? 20 2.3 Derivations Using a Context-Free Grammar 21 2.4 Language Defined by a Context-Free Grammar 23 2.5 Different Ways of Representing Context-Free Grammars 25 2.6 Some Simple Grammars 26 2.7 Techniques for Generating Languages with Context-Free Grammars 29 2.8 Regular and Right Linear Grammars 35 2.9 Counting with Regular Grammars 37 2.0 Grammars for Lists 39 2.10 An Important Language that is Not Context Free 44 Problems 45 Chapter 3. Context-Free Grammars, Part 2 49 3.1 Introduction 49 3.2 Parse Trees 49 3.3 Leftmost and Rightmost Derivations 51 3.4 Substitution 52 3.5 Ambiguous Grammars 54 3.6 Determining Nullable Nonterminals 59 3.7 Eliminating Lambda Productions 60 3.8 Eliminating Unit Productions 64 3.9 Eliminating Useless Nonterminals 66 3.10 Recursion Conversions 71 3.11 Adding the Null String to a Language 76 Problems 77 Chapter 4. Context-Free Grammars, Part 3 83 4.1 Introduction 83 4.2 Grammars for Arithmetic Expressions 83 4.3 Specifying Associativity and Precedence in Grammars 90 4.4 BackusNaur Form 92 4.5 Syntax Diagrams 94 4.6 Abstract Syntax Trees and Three-Address Code 96 4.7 Noncontracting Grammars 97 4.8 Essentially Noncontracting Grammars 97 4.9 Converting a Context-Free Grammar to an Essentially Noncontracting Grammar 98 4.10 Pumping Property of Context-Free Languages 101 Problems 104 Chapter 5. Chomsky's Hierarchy 107 5.1 Introduction 107 5.2 ContextSensitive Productions 107 5.3 ContextSensitive Grammars 110 5.4 Unrestricted Grammars 111 Problems 112 Chapter 6. Top-Down Parsing 115 6.1 Introduction 115 6.2 TopDown Construction of a Parse Tree 115 6.3 Parses that Fail 117 6.4 A Bad Grammar for Top-Down Parsing 118 6.5 Deterministic Parses 119 6.6 A Parser that Uses a Stack 120 6.7 Table Representation of a Stack Parser 124 6.8 Handling Productions with Nonleading Terminal 126 6.9 Writing a Stack Parser in Java 127 Problems 134 Chapter 7. LL(1) Grammars 137 7.1 Introduction 137 7.2 FIRST Set of the Right Side of a Production 137 7.3 Determining Operation Sequences 140 7.4 Determining Selection Sets of Lambda Productions 142 7.5 WhateverFollowsLeftFollowsRightmost Rule 145 7.6 Selection Sets for Productions with Nullable Right Sides 147 7.7 Selection Sets Containing End-of-Input Symbol 149 7.8 A Stack Parser for a Grammar with Lambda Productions 152 7.9 Converting a Non-LL(1) Grammar to an LL(1) Grammar 153 7.10 Parsing with an Ambiguous Grammar 160 7.11 Computing FIRST and FOLLOW Sets 163 Problem 165 Chapter 8. Table-Driven Stack Parser 171 8.1 Introduction 171 8.2 Unifying the Operations of a Stack Parser 172 8.3 Implementing a Table-Driven Stack Parser 175 8.4 Improving Our Table-Driven Stack Parser 180 8.5 Parsers that are Not Deterministic--A Digression on Theory 181 Problems 183 Chapter 9. Recursive-Descent Parsing 185 9.1 Introduction 185 9.2 Simple Recursive-Descent Parser 185 9.3 Handling Lambda Productions 192 9.4 A Common Error 197 9.5 Java Code for Productions 198 9.6 Left Factoring in a Recursive-Descent Parser 199 9.7 Eliminating Tail Recursion 204 9.8 Translating the Star, Plus, and Questi