ANTLR is a parser generator: a program that generates code to translate a specified input language into a nice, tidy data structure. You can use parser generators to build translators and interpreters for all kinds of domain-specific languages including proprietary data formats, common network protocols, text-processing languages, and domain-specific programming languages.
In this book, you’ll find details on:
• Creating ANTLR grammar syntax
• Resolving grammar ambiguities
• Parser fault tolerance and error reporting
• Embedding actions
• Building intermediate-form trees
• Extracting information from trees
• Generating source code
• Using the ANTLR Java API
Developers are increasingly using domain-specific languages (DSLs) as they develop more and more sophisticated applications. ANTLR is their tool of choice. And now, with this definitive guide, developers have an up-to-date reference for that tool.
The pattern implementations are shown using Java, but the patterns themselves are completely general and aren’t language-specific. Some of the implementations use the well-known ANTLR parser generator, so readers will find this book an excellent source of ANTLR examples as well.
Each chapter groups related design patterns. In each you’ll get hands-on experience by building a complete sample implementation. By the time you finish this book, you’ll know how to solve most common language implementation problems.