The definitive ANTLR 4 reference

Programmers run into parsing problems all the time. Whether it's a data format like JSON, a network protocol like SMTP, a server configuration file for Apache, a PostScript/PDF file, or a simple spreadsheet macro language--ANTLR v4 and this book will demystify the process. ANTLR v4 has been re...

Descripción completa

Detalles Bibliográficos
Otros Autores: Parr, Terence author (author)
Formato: Libro electrónico
Idioma:Inglés
Publicado: Dallas, Texas ; Raleigh, North Carolina : The Pragmatic Bookself 2012.
Edición:2nd edition
Colección:Pragmatic Programmers
Materias:
Ver en Biblioteca Universitat Ramon Llull:https://discovery.url.edu/permalink/34CSUC_URL/1im36ta/alma991009629479506719
Tabla de Contenidos:
  • Part I. Introducing ANTLR and Computer Languages. Meet ANTLR ; The Big Picture ; A Starter ANTLR Project ; A Quick Tour
  • Part II. Developing Language Applications with ANTLR Grammars. Designing Grammars ; Exploring Some Real Grammars ; Decoupling Grammars from Application-Specific Code ; Building Some Real Language Applications
  • Part III. Advanced Topics. Error Reporting and Recovery ; Attributes and Actions ; Altering the Parse with Semantic Predicates ; Wielding Lexical Black Magic
  • Part IV. ANTLR Reference. Exploring the Runtime API ; Removing Direct Left Recursion ; Grammar Reference.
  • Machine generated contents note: pt. I Introducing ANTLR and Computer Languages
  • 1. Meet ANTLR
  • 1.1. Installing ANTLR
  • 1.2. Executing ANTLR and Testing Recognizers
  • 2. The Big Picture
  • 2.1. Let's Get Meta!
  • 2.2. Implementing Parsers
  • 2.3. You Can't Put Too Much Water into a Nuclear Reactor
  • 2.4. Building Language Applications Using Parse Trees
  • 2.5. Parse-Tree Listeners and Visitors
  • 3.A Starter ANTLR Project
  • 3.1. The ANTLR Tool, Runtime, and Generated Code
  • 3.2. Testing the Generated Parser
  • 3.3. Integrating a Generated Parser into a Java Program
  • 3.4. Building a Language Application
  • 4.A Quick Tour
  • 4.1. Matching an Arithmetic Expression Language
  • 4.2. Building a Calculator Using a Visitor
  • 4.3. Building a Translator with a Listener
  • 4.4. Making Things Happen During the Parse
  • 4.5. Cool Lexical Features
  • pt. II Developing Language Applications with ANTLR Grammars
  • 5. Designing Grammars
  • 5.1. Deriving Grammars from Language Samples
  • 5.2. Using Existing Grammars as a Guide
  • 5.3. Recognizing Common Language Patterns with ANTLR Grammars
  • 5.4. Dealing with Precedence, Left Recursion, and Associativity
  • 5.5. Recognizing Common Lexical Structures
  • 5.6. Drawing the Line Between Lexer and Parser
  • 6. Exploring Some Real Grammars
  • 6.1. Parsing Comma-Separated Values
  • 6.2. Parsing JSON
  • 6.3. Parsing DOT
  • 6.4. Parsing Cymbol
  • 6.5. Parsing R
  • 7. Decoupling Grammars from Application-Specific Code
  • 7.1. Evolving from Embedded Actions to Listeners
  • 7.2. Implementing Applications with Parse-Tree Listeners
  • 7.3. Implementing Applications with Visitors
  • 7.4. Labeling Rule Alternatives for Precise Event Methods
  • 7.5. Sharing Information Among Event Methods
  • 8. Building Some Real Language Applications
  • 8.1. Loading CSV Data
  • 8.2. Translating JSON to XML
  • 8.3. Generating a Call Graph
  • 8.4. Validating Program Symbol Usage
  • pt. III Advanced Topics
  • 9. Error Reporting and Recovery
  • 9.1.A Parade of Errors
  • 9.2. Altering and Redirecting ANTLR Error Messages
  • 9.3. Automatic Error Recovery Strategy
  • 9.4. Error Alternatives
  • 9.5. Altering ANTLR's Error Handling Strategy
  • 10. Attributes and Actions
  • 10.1. Building a Calculator with Grammar Actions
  • 10.2. Accessing Token and Rule Attributes
  • 10.3. Recognizing Languages Whose Keywords Aren't Fixed
  • 11. Altering the Parse with Semantic Predicates
  • 11.1. Recognizing Multiple Language Dialects
  • 11.2. Deactivating Tokens
  • 11.3. Recognizing Ambiguous Phrases
  • 12. Wielding Lexical Black Magic
  • 12.1. Broadcasting Tokens on Different Channels
  • 12.2. Context-Sensitive Lexical Problems
  • 12.3. Islands in the Stream
  • 12.4. Parsing and Lexing XML
  • pt. IV ANTLR Reference
  • 13. Exploring the Runtime API
  • 13.1. Library Package Overview
  • 13.2. Recognizers
  • 13.3. Input Streams of Characters and Tokens
  • 13.4. Tokens and Token Factories
  • 13.5. Parse Trees
  • 13.6. Error Listeners and Strategies
  • 13.7. Maximizing Parser Speed
  • 13.8. Unbuffered Character and Token Streams
  • 13.9. Altering ANTLR's Code Generation
  • 14. Removing Direct Left Recursion
  • 14.1. Direct Left-Recursive Alternative Patterns
  • 14.2. Left-Recursive Rule Transformations
  • 15. Grammar Reference
  • 15.1. Grammar Lexicon
  • 15.2. Grammar Structure
  • 15.3. Parser Rules
  • 15.4. Actions and Attributes
  • 15.5. Lexer Rules
  • 15.6. Wildcard Operator and Nongreedy Subrules
  • 15.7. Semantic Predicates
  • 15.8. Options
  • 15.9. ANTLR Tool Command-Line Options.