Edinburgh Castle
The Definitive ANTLR Reference : Building Domain-Specific Languages
AuthorsTerence Parr
PublisherPragmatic Programmers
DateMay 2007
ReviewerAndy Scott
Cover image for ANTLR Reference


A well paced and structured book that covers the tasks, technologies and theory required to create your own language parsers.


The book very cleverly and deliberately dovetails with the information that is already in the public domain for ANTLR; it highlights the fact that it is possible to produce a printed publication for a predominantly "live" web based tool that is more than worth the cost and effort to obtain it. There are numerous links back to the "live" documentation on the tool's web site should the reader wish to delve or involve themselves further with the topic being discussed. These do not detract from the information in the book or serve as padding - they point the reader to the best source of the information and work to help the reader gain a better understanding of the subject.

The style of the writing is also at the right level; having read through two revisions of the "Dragon" book and other very technical language processing theory books at university I am well aware of just how dry and academic the subject matter can be. This is avoided with a clear focus on what you need to do without a full discussion of the theory behind it. Those sections that deal with the theoretical background of how ANTLR does what it does are carefully quarantined in their own section and clearly indicated that they are quite difficult. This structure means that anyone reading the book can happily understand how to manipulate ANTLR to do what they need without being put off with pages of very dry and complex algorithms.

Given that ANTLR can generate parsers in a wide range of languages now, I would personally liked to have seen some of the examples use them, perhaps C/C++. I am more at home with Python & C/C++ than some of the Java examples used; offsetting that are the facts that obviously Java is the author's chosen first language and the consistency that having all of the examples in the same language achieves.

The range of the topics covered is again well thought out and well structured to lead the reader through the subject matter; a fact I suppose you should expect as the author is now a professor and has undoubtedly spent many an hour lecturing to undergraduates.

Table of contents

The Definitive ANTLR Reference : Building Domain-Specific Languages

Ch  1. Getting Started with ANTLR
Ch  2. The Nature of Computer Languages
Ch  3. A Quick Tour for the Impatient
Ch  4. ANTLR Grammars
Ch  5. ANTLR Grammar-Level Options
Ch  6. Attributes and Actions
Ch  7. Tree Construction
Ch  8. Tree Grammars
Ch  9. Generating Structured Tet with Templates and Grammars
Ch 10. Error Reporting and Recovery
Ch 11. LL(*)Parsing
Ch 12. Using Semantic and Syntactic Predicates
Ch 13. Semantic Predicates
Ch 14. Syntactic Predicates

faded separator

Page maintained via github.com/edinburgh-pm/edinburgh.pm