Skip to content

Book Review: The Definitive ANTLR Reference

February 13, 2008

Having needed to so some parsing recently I picked up a copy of The Definitive ANTLR Reference: Building Domain-Specific Languages from The Pragmatic Bookshelf. I’ve found myself purchasing a lot of their books recently. The PDF versions are great in particular because they come with no nasty DRM and are genuinely cheaper than the dead tree equivalent.

The book itself weighs in at a reasonable 358 pages. I attempted to initially learn all about ANTLR 3 from the website. Unfortunately like many open source projects the online documentation is somewhat lacking. I think sometimes that people think that if they put up a wiki then everything magically becomes organized. While I’ve seen good examples of wiki based sites it is usually because someone has put in a lot of time and trouble to structure it well.

In any case I usually don’t mind shelling out a little money to purchase a book. In this case I’m pretty happy with the book itself. The sometimes complicated subject of parsing is covered in a good amount of detail. Someone wishing to skim the subject and get going quickly will be well served by reading through the first few chapters in the book.

Strangely after an introduction to the subject the book jumps directly into the reference material. Most books I’ve seen actually put this sort of material at the end. I’m not sure why Terence chose to put this right after the introductory chapters. Regardless you’re always free to skim over this section. Be careful however… by chapter 8 (Tree Construction) the material becomes decidedly less referencey so don’t skim the reference section completely.

The final section of the book covers the more difficult material such as exactly what LL(*) does for you, how to use semantic and syntactic predicates to solve parsing conflicts and a good amount of detail in backtracking and memoization.

Certainly you can’t go too far wrong by purchasing this book although very little of the book directly talks about domain specific languages. I think that is in there more for marketing reasons which I personally find somewhat annoying.

The book also gives very little time to covering generating parsers in languages other than Java even though the tool is supposed to be capable of this. I find this somewhat strange however I’m sure it wouldn’t be hard to figure this out without help from the book.

ANTLR itself is a great tool. The subject matter is initially intimidating but in practice it isn’t hard at all to get a working parser going. The ANTLR-works tool that ships with v3 is simply amazing and makes building a grammar really easy. Recommended to anyone wanting to build a parser.

From → Technical

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: