| Copyright |
| Foreword |
| Preface |
| | Who Should Read This Book |
| | Using the Toolkit Code and the Sample Code |
| | Related Books |
| | Theoretical Context |
| | Yacc and Lex and Bison and Flex |
| | About the Cover |
| | Acknowledgments |
|
| Chapter 1. Introduction |
| | Section 1.1. The Role of Parsers |
| | Section 1.2. What Is a Language? |
| | Section 1.3. The Organization of This Book |
| | Section 1.4. Summary |
|
| Chapter 2. The Elements of a Parser |
| | Section 2.1. What Is a Parser? |
| | Section 2.2. Parser Collaborations |
| | Section 2.3. Assemblies |
| | Section 2.4. The Parser Hierarchy |
| | Section 2.5. Terminal Parsers |
| | Section 2.6. Composite Parsers |
| | Section 2.7. Assemblers |
| | Section 2.8. Summary |
|
| Chapter 3. Building a Parser |
| | Section 3.1. Design Overview |
| | Section 3.2. Deciding to Tokenize |
| | Section 3.3. Designing Assemblers |
| | Section 3.4. Grammars: A Shorthand for Parsers |
| | Section 3.5. Example: Designing a Grammar for a Track Robot |
| | Section 3.6. Translating a Grammar to Code |
| | Section 3.7. Completing a Parser |
| | Section 3.8. Summary |
|
| Chapter 4. Testing a Parser |
| | Section 4.1. Feature Testing |
| | Section 4.2. Random Testing |
| | Section 4.3. Special Tokenizers and Targets |
| | Section 4.4. Summary |
|
| Chapter 5. Parsing Data Languages |
| | Section 5.1. The Role of Data Languages |
| | Section 5.2. A Data Language Example |
| | Section 5.3. A Coffee Grammar |
| | Section 5.4. A Tokenizing Problem |
| | Section 5.5. Coffee Assemblers |
| | Section 5.6. Translating the Coffee Grammar to Code |
| | Section 5.7. Data Language Parser Summary |
| | Section 5.8. Parsers with XML |
| | Section 5.9. Helpers |
| | Section 5.10. Summary |
|
| Chapter 6. Transforming a Grammar |
| | Section 6.1. The Role of Grammar Transformation |
| | Section 6.2. Ensuring Correct Associativity |
| | Section 6.3. Eliminating Left Recursion |
| | Section 6.4. Ensuring Proper Precedence |
| | Section 6.5. Eliminating Parser Class Loops |
| | Section 6.6. Summary |
|
| Chapter 7. Parsing Arithmetic |
| | Section 7.1. Building an Arithmetic Parser |
| | Section 7.2. An Arithmetic Grammar |
| | Section 7.3. Arithmetic Assemblers |
| | Section 7.4. An Arithmetic Grammar Parser |
| | Section 7.5. Summary |
|
| Chapter 8. Parsing Regular Expressions |
| | Section 8.1. The Role of Regular Expressions |
| | Section 8.2. Building a Regular Expression Parser |
| | Section 8.3. A Regular Expression Grammar |
| | Section 8.4. Regular Expression Assemblers |
| | Section 8.5. A Regular Expression Parser |
| | Section 8.6. Summary |
|
| Chapter 9. Advanced Tokenizing |
| | Section 9.1. The Role of a Tokenizer |
| | Section 9.2. Acquiring a Tokenizer |
| | Section 9.3. Tokenizers in Standard Java |
| | Section 9.4. A Token Class |
| | Section 9.5. A Tokenizer Class |
| | Section 9.6. Tokenizer Lookup Tables |
| | Section 9.7. Tokenizer States |
| | Section 9.8. Setting a Tokenizer's Source |
| | Section 9.9. Customizing a Tokenizer |
| | Section 9.10. The TokenStringSource Utility |
| | Section 9.11. Token Strings |
| | Section 9.12. Summary |
|
| Chapter 10. Matching Mechanics |
| | Section 10.1. Introduction |
| | Section 10.2. Parser Matching |
| | Section 10.3. Repetition Matching |
| | Section 10.4. Collection Parsers |
| | Section 10.5. Sequence Matching |
| | Section 10.6. Alternation Matching |
| | Section 10.7. Empty Matching |
| | Section 10.8. Terminal Matching |
| | Section 10.9. Parser Matching Utilities |
| | Section 10.10. Summary |
|
| Chapter 11. Extending the Parser Toolkit |
| | Section 11.1. The Role of New Types of Parsers |
| | Section 11.2. New Terminals |
| | Section 11.3. New Token Types |
| | Section 11.4. New Parser Features |
| | Section 11.5. Summary |
|
| Chapter 12. Engines |
| | Section 12.1. Engines versus Interpreters |
| | Section 12.2. The Role of Engines |
| | Section 12.3. Building Blocks |
| | Section 12.4. Unification |
| | Section 12.5. Facts |
| | Section 12.6. Programs and Queries |
| | Section 12.7. Proofs |
| | Section 12.8. Rules |
| | Section 12.9. Additional Features of the Engine |
| | Section 12.10. Summary |
|
| Chapter 13. Logic Programming |
| | Section 13.1. The Role of Logic Languages |
| | Section 13.2. Building Blocks |
| | Section 13.3. A Logikus Interactive Development Environment |
| | Section 13.4. Unification |
| | Section 13.5. Comparisons |
| | Section 13.6. Rules, Axioms, and Programs |
| | Section 13.7. Proofs |
| | Section 13.8. Additional Features of Logikus |
| | Section 13.9. Lists |
| | Section 13.10. List Applications |
| | Section 13.11. Modeling Transitive and Symmetric Relations |
| | Section 13.12. Example Applications |
| | Section 13.13. Summary |
|
| Chapter 14. Parsing a Logic Language |
| | Section 14.1. Building a Logic Language Environment |
| | Section 14.2. A Logikus Grammar |
| | Section 14.3. Logikus Assemblers |
| | Section 14.4. The Logikus Interactive Development Environment |
| | Section 14.5. Summary |
|
| Chapter 15. Parsing a Query Language |
| | Section 15.1. The Role of Query Languages |
| | Section 15.2. A Sample Database |
| | Section 15.3. Jaql |
| | Section 15.4. Building a Query Language Environment |
| | Section 15.5. Translating User Queries to Engine Queries |
| | Section 15.6. A Query Builder |
| | Section 15.7. A Speller |
| | Section 15.8. Jaql Grammar |
| | Section 15.9. Creating the Jaql Parser |
| | Section 15.10. Jaql Assemblers |
| | Section 15.11. The Jaql User Environment |
| | Section 15.12. Summary |
|
| Chapter 16. Parsing an Imperative Language |
| | Section 16.1. The Role of Imperative Languages |
| | Section 16.2. Sling |
| | Section 16.3. Sling Programming |
| | Section 16.4. Building the Sling Environment |
| | Section 16.5. Building Commands |
| | Section 16.6. Sling Commands |
| | Section 16.7. Building Runtime Functions |
| | Section 16.8. Sling Functions |
| | Section 16.9. Sling Target |
| | Section 16.10. A Sling Grammar |
| | Section 16.11. Sling Assemblers |
| | Section 16.12. A Sling Parser |
| | Section 16.13. Summary |
|
| Chapter 17. Directions |
| | Section 17.1. Get Started |
| | Section 17.2. Keep Going |
|
| Appendix A. UML Twice Distilled |
| | Section A.1. Classes |
| | Section A.2. Class Relationships |
| | Section A.3. Interfaces |
| | Section A.4. Objects |
|
| References |