[antlr-interest] what would ANTLR ref guide revised edition have?

Kirby Bohling kirby.bohling at gmail.com
Tue Feb 15 17:46:27 PST 2011


On Tue, Feb 15, 2011 at 5:36 PM, Terence Parr <parrt at cs.usfca.edu> wrote:
> Howdy. I'm thinking about revising the ref guide for ANTLR 3 (ANTLR v4 might be awhile so I should update book).  Any suggestions to improve?  One obvious thing: discuss not just java target :)
>
> Ter
>

The thing I struggled with the most was overcoming my Lex-like
expectations of the Lexer (which as I understand it is something to be
addressed in Antlr4).  A lot of people appear to struggle with the
lexer not falling back to the last matched token if there was a
partial match that didn't reach completion.

The other piece of advise I had to take to heart was avoiding inline
tokens in my Parser which are inserted if you have a combined grammar.
 I can't remember if the book or the list advised avoiding those, but
specifying the lexer grammar and parser grammar separately greatly
helped me overcome my incorrect assumptions (backtracking the lexer
and parser are different).  As virtually every example used a combined
grammar, and had implicit tokens in the parser rules often, I had many
problems because I didn't grok the rules about when and how to safely
use implicit tokens.  Once I stopped using them entirely, ANTLR became
a much smoother experience.

Kirby


More information about the antlr-interest mailing list