Want to receive a weekly email containing
the scoop on our new titles along with the
occasional special offer? Just click the button.
(You can always unsubscribe later by editing your
account information).

Give us an email and a password (you can use the password later to log in and
change your preferences). We'll send you a newsletter roughly once a week.

The Definitive ANTLR Reference: Building Domain-Specific Languages

by Terence Parr

The chart shows the approximate number of words in each chapter of The Definitive ANTLR Reference per week. The latest numbers are highlighted—mouse over prior weeks to see their figures.

ANTLR v3 is the most powerful, easy-to-use parser generator built to date, and represents the culmination of more than 15 years of research by Terence Parr. This book is the essential reference guide to using this completely rebuilt version of ANTLR, with its amazing new LL(*) parsing technology, tree construction facilities, StringTemplate code generation template engine, and sophisticated ANTLRWorks GUI development environment. Learn to use ANTLR directly from the author!

Buy Now

We can automatically send them to your Kindle,
and your Dropbox.
(You'll need to log in to enable these options.)

About this Book

384 pages

Published: 2007-05-01

Release: P4.0 (2011-04-11)

ISBN: 978-0-9787-3925-6

ANTLR is a parser generator: a program that generates code to translate a specified input language into a nice, tidy data structure. You might think that parser generators are only used to build compilers. But in fact, programmers usually use parser generators to build translators and interpreters for domain-specific languages such as proprietary data formats, common network protocols, text processing languages, and domain-specific programming languages.

Domain-specific languages are important to software development because they represent a more natural, high fidelity, robust, and maintainable means of encoding a problem than simply writing software in a general-purpose language. For example, NASA uses domain-specific command languages for space missions to improve reliability, reduce risk, reduce cost, and increase the speed of development. Even the first Apollo guidance control computer from the 1960s used a domain-specific language that supported vector computations.

This book is the definitive guide to using the completely rebuilt ANTLR v3 and describes all features in detail, including the amazing new LL(*) parsing technology, tree construction facilities, StringTemplate code generation template engine, and sophisticated ANTLRWorks GUI development environment. You’ll learn all about ANTLR grammar syntax, resolving grammar ambiguities, parser fault tolerance and error reporting, embedding actions to interpret or translate languages, building intermediate-form trees, extracting information from trees, generating source code, and how to use the ANTLR Java API.

Contents and Extracts

About the Author

Terence Parr is a professor of computer science and graduate program director at the University of San Francisco, where he continues to work on his ANTLR parser generator, antlr.org. Terence has consulted for and held various technical positions at companies such as IBM, Lockheed Missiles and Space, NeXT, and Renault Automation. Terence holds a Ph.D. in computer engineering from Purdue University and was a postdoctoral fellow at the Army High-Performance Computing Research Center at the University of Minnesota, where he built parallelizing FORTRAN source-to-source translators.

Comments and Reviews

The Definitive ANTLR Reference deserves a place in the bookshelf of anyone who ever has to parse or translate text. ANTLR is not just for language designers any more.

—Bob McWhirterFounder of the JBoss Rules ProjecJBoss.org

Over the course of a career, developers move through a few stages of sophistication: becoming effective with a single programming language, learning which of several programming languages to use, and finally learning to tailor the language to the task at hand. This approach was previously reserved for those with an education in compiler development. Now, The Definitive ANTLR Reference reveals that it doesn’t take a PhD to develop your own domain-specific languages, and you would be surprised how often it is worth doing. Take the next step in your career, and buy this book.

Whether you are a compiler-newbie itching to write your own language or a jaded yacc veteran tired of shift-reduce conflicts, keep this book by your side. It is at once a tutorial, a reference and an insider’s viewpoint.

—Sriram SrinivasanFormer Principal EngineerBEA/Weblogic

Over the last few years ANTLR has proven itself as a solid parser generator. This book is a fine guide to making the best use of it.

—Martin FowlerChief ScientistThoughtWorks

ANTLR v3 and The Definitive ANTLR Reference Guide present a compelling package: An intuitive tool that handles complex recognition and translation tasks with ease and a clear book detailing how to get the most from it. The book provides an in-depth account of language translation utilizing the new powerful LL(*) parsing strategy. If you’re developing translators, you can’t afford to ignore this book!

—Dermot O'NeillSenior DeveloperOracle Corporation

Eclipse IDE users have become accustomed to cool features such as single click navigation between symbol references and declarations, not to mention intelligent content assist. ANTLR version 3 with it’s LL(*) parsing algorithm will help us immensely in building highly complex parsers to support these features. This book is a critical resource for Eclipse developers and others who wish to take full advantage of the power of the new features in ANTLR.

Terence’s new book is an excellent guide to ANTLR 3. It is very well written, with both the student and developer in mind. The book does not assume compiler design experience. It provides the necessary background, from a pragmatic rather than a theoretical perspective, and it then eases the new user, whether someone with previous compiler design experience or not, into the use of the ANTLR tools. I recommend this book highly for anyone who has a need to incorporate language capabilities into their software design.

—Jesse GrodnikSoftware Development ManagerSun Microsystems, Inc.

This book really gave me a much better understanding of the principles of language recognition as a whole. I’d recommend this book for anyone without a background in language recognition looking to start using ANTLR or just trying to understand the concept of language recognition.