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!
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 templateengine, 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.
User review
Best source available on ANTLR
This is a book I would highly recommend to anyone writing a translator with ANTLR. Although there is no shortage of information regarding ANTLR on the Web, there is a lot more in the book itself.
Creating grammars for language recognition is one of those complex topics that have been theorized a lot. Mastering them seems the privilege of academics and PhD s.
Terence Parr is definitely one of these gifted academics. Part III of the book is proof enough that he knows this topic in and out. But unlike other academic brains, Terence also profoundly understands software developers. That gives an extremely practical and example-rich part I and II. The samples provided are much more detailed and clearly explained than the online material I could find. This mixture of science, pedagogy and software engineering is very unique.
Like many other software developers who burnt their fingers with LEX and YACC, I tended to stay away from grammar-based language recognition. After reading this book, I feel much more comfortable with the subject.
User review
Frustrated learner
If you are new to programming, forget it. This book assumes a certain advanced knowledge of programming. It has no chapter exercises to test your knowledge as you go along. It has no glossary defining key terms. It also does not have loads of information on ANTLRWorks, a GUI designed to make your experience with ANTLR more pleasurable. If Mr. Parr (author) prints another edition, I sure hopes he takes this into consideration. There are online references cited in the book which give more background on ANTLR, but there are no building exercises for those who are not advanced programmers. It shuts out those with less knowledge, who want a new learning experience in software. It's too bad because it looks like good software.
User review
Readable
I have just finished reading the ANTLR ref book and I thought it was helpful, yes I also agree that it was a bit too much Java being more of a C++/C# person but I am not that picky. The one thing that I didn't like with the book was the structure. The four last chapters contain the actual theory, and one chapter in the middle was the reference. I didn't like this, it didn't feel natural. I would have liked to have the theory first and then gotten on with the details, building upon examples with increasing complexity (preferably not only in Java ;-). Also the index wasn't good, it should have been more detailed. e.g. where can I find what input.LT(1) means?
A good thing was there exists a mailing list and of course the website which helps to fill the holes that book unfortunately sometimes leaves.
User review
An excellent book for developing language translators, especially for Java programmers
The book of Terence Parr describes his ANTLR LL top-down parser generator
very clearly and with outstanding academic style of presentation.
The ANTLR tool is powerful, I like to use it, since it easier to use and
more well documented (with the Parr's book) than the alternative javacc tool
or the traditional lex/yacc/bison tools.
Shortly, I strongly recommend the Terence's book to both the
industrial programmers/developers and to the academic community.
User review
For Sun fans only
This book very thoroughly documents the ANTLR parser generator, but it does so with a Java bias that is so strong it excludes all of the other languages ANTLR supports. This makes sense on some level since ANTLR is a Java tool written by a Java developer, but for those of us who have an equally strong bias AGAINST Java the example code can best be described as nap inducing.
If you want to use ANTLR with C or Python or any other language, stick to the free documentation on the web.