This was my summer holiday reading. I should perhaps have taken a slightly longer book, but I wanted to keep the weight down.
The author of this book is also the creator of ANTLR (Another Tool for Language Recognition, something that I’d always imagined be some sort of backronym from LR, but no, ANTLR is LL – LR and LL being parser types). Parr clearly knows his stuff, and does a good job of explaining the processes. The explanations are clear and well laid out. The sample code is mostly in Java, but it is simple enough that anyone with a grounding in C or C++ should be able to follow it.
The chapters are mostly split into two parts. First is an overall introduction to the theory being covered. This then leads to ‘Patterns’, which cover the specifics and example implementations in more details. Often design choices are presented along with their advantages and disadvantages. The book progresses from basic parsing to template-driven generators in a steady fashion. Perhaps this comes from the study of grammars, but the explanations all seemed to progress without there ever being a need to refer to matter covered later in the book.
I only have a fairly small amount of experience with parsers and lexers (mainly with flex and bison), so the parts that were the most interesting to me were the extras that such old-school tools don’t offer (that I know of) like data models and rule rewriting.
Finally, I enjoyed this book so much that on return from my holidays I bought The Definitive ANTLR 4 Reference by the same author (watch this space, but don’t hold your breath).