Description
Compiler Construction, Java-Intermediate Programming.
Features
Table Of Contents
(NOTE: Each chapter concludes with a Summary.)
Foreword.
Preface.
Who Should Read This Book.
Using the Toolkit Code and the Sample Code.
Contents of the CD.
Applying the Code on the CD.
Hello World.
Coding Style.
Related Books.
Theoretical Context.
Yacc and Lex and Bison and Flex.
About the Cover.
Acknowledgments.
Using the Toolkit Code and the Sample Code.
Contents of the CD.
Applying the Code on the CD.
Hello World.
Coding Style.
Related Books.
Theoretical Context.
Yacc and Lex and Bison and Flex.
About the Cover.
Acknowledgments.
1. Introduction.
The Role of Parsers.
What Is a Language?
The Organization of This Book.
What Is a Language?
The Organization of This Book.
2. The Elements of a Parser.
What Is a Parser?
Parser Collaborations.
Assemblies.
The Parser Hierarchy.
Terminal Parsers.
Composite Parsers.
Assemblers.
Parser Collaborations.
Assemblies.
The Assembly Class Interfaces.
Token and Character Assemblies.
Tokenizing.
Default and Custom Tokenization.
Assembly Appearance.
Assembly Summary.
Token and Character Assemblies.
Tokenizing.
Default and Custom Tokenization.
Assembly Appearance.
Assembly Summary.
The Parser Hierarchy.
The Composition of a Parser.
Terminal Parsers.
Using Terminals.
Word Terminals.
Num Terminals.
Literals.
Caseless Literals.
Symbols.
Quoted Strings.
Word Terminals.
Num Terminals.
Literals.
Caseless Literals.
Symbols.
Quoted Strings.
Composite Parsers.
Repetition.
Alternation and Sequence.
Composing a Parser.
The Empty Parser.
Parser Summary.
Alternation and Sequence.
Composing a Parser.
The Empty Parser.
Parser Summary.
Assemblers.
Parsers Use Assemblers.
Assemblers Work On Assemblies.
Elements Above.
Assemblers Work On Assemblies.
Elements Above.
3. Building a Parser.
Design Overview.
Deciding to Tokenize.
Designing Assemblers.
Grammars: A Shorthand for Parsers.
Example: Designing a Grammar for a Track Robot.
Translating a Grammar to Code.
Completing a Parser.
Deciding to Tokenize.
Designing Assemblers.
The Collaboration of Parsers, Assemblers, and Assemblies.
Using an Assembly's Stack.
Assemblers Plug In to Parser Composites.
A Language to Plug In To: Minimath.
Calculating a Minimath Result.
The Minimath Parser as an Object.
Building a Target.
Making a Target Cloneable.
Using an Assembly's Stack.
Assemblers Plug In to Parser Composites.
A Language to Plug In To: Minimath.
Calculating a Minimath Result.
The Minimath Parser as an Object.
Building a Target.
Making a Target Cloneable.
Grammars: A Shorthand for Parsers.
Standard Grammar Shorthand.
Top-Down Grammar Design.
Top-Down Grammar Design.
Example: Designing a Grammar for a Track Robot.
A Track Robot Grammar.
Checking for Left Recursion and Cycles.
Checking for Left Recursion and Cycles.
Translating a Grammar to Code.
Translate Quoted Strings.
Translate Sequences.
Translate Alternations.
Translate Terminals.
Create a Subparser for Each Rule.
Option 1: Declare Each Subparser.
Option 2: Arrange Subparsers as Methods.
Add a Start Method.
Translate Sequences.
Translate Alternations.
Translate Terminals.
Create a Subparser for Each Rule.
Option 1: Declare Each Subparser.
Option 2: Arrange Subparsers as Methods.
Add a Start Method.
Completing a Parser.
Control Pushing.
Design the Target.
Plug In Assemblers.
Design the Target.
Plug In Assemblers.
4. Testing a Parser.
Feature Testing.
Random Testing.
Special Tokenizers and Targets.
Random Testing.
Ambiguity Testing.
Terminal Ambiguity.
Terminal Ambiguity.
Special Tokenizers and Targets.
5. Parsing Data Languages.
The Role of Data Languages.
A Data Language Example.
A Coffee Grammar.
A Tokenizing Problem.
Coffee Assemblers.
Translating the Coffee Grammar to Code.
Data Language Parser Summary.
Parsers with XML.
Helpers.
A Data Language Example.
A Coffee Grammar.
A Tokenizing Problem.
Coffee Assemblers.
Coffee Assembler Code.
Translating the Coffee Grammar to Code.
Data Language Parser Summary.
Parsers with XML.
A Brief History of XML.
The Evolution of XML.
An XML Example.
The Evolution of XML.
An XML Example.
Helpers.
ShowCoffeeXML.
6. Transforming a Grammar.
The Role of Grammar Transformation.
Ensuring Correct Associativity.
Eliminating Left Recursion.
Ensuring Proper Precedence.
Eliminating Parser Class Loops.
Ensuring Correct Associativity.
Eliminating Left Recursion.
An Algorithm.
Ensuring Proper Precedence.
Eliminating Parser Class Loops.
7. Parsing Arithmetic.
Building an Arithmetic Parser.
An Arithmetic Grammar.
Arithmetic Assemblers.
An Arithmetic Grammar Parser.
Conventional Symbols.
Conventional Precedence.
Conventional Associativity.
Conventional Precedence.
Conventional Associativity.
An Arithmetic Grammar.
Arithmetic Assemblers.
Assembler Code.
An Arithmetic Grammar Parser.
8. Parsing Regular Expressions.
The Role of Regular Expressions.
Building a Regular Expression Parser.
A Regular Expression Grammar.
Regular Expression Assemblers.
A Regular Expression Parser.
Building a Regular Expression Parser.
A Regular Expression Grammar.
Regular Expression Assemblers.
Assembler Code.
A Regular Expression Parser.