[antlr-interest] v4 "Honey Badger" teaser

Terence Parr parrt at cs.usfca.edu
Fri Dec 30 16:47:14 PST 2011

On Dec 30, 2011, at 2:34 PM, Gavin Lambert wrote:
> On a tangentially related note, it'd be good if v4 fixed up the lexer-predicate problem (where predicates get ignored because they only apply to alts, not rule selection; ignoring the fact that lexer rules are really just alts of the implicit TOKENS rule) -- then you could handle Graham's more-complicated-character-matching cases with something like this:
>  SPECIAL: { isSpecialThreeCharKeyword() }? . . .;
> Or even:
>  SPECIAL: { isSpecialKeyword() }? { emitSpecialKeyword(); };

ThisHas been fixed, though for efficiency it's best if you put those predicates at the end of the rule. I cannot create a DFA looking through predicates. So it's best to let me create a DFA and then test the predicate at the end. er… maybe I hang onto the predicate until the end anyway. Can't remember. Point is that the lexers or SOOoooo much better you will believe it.

The thing that I'm really liking about v4 is that you can just give it any grammar you want and it will do its best.  it's the honey badger, and it's bad ass ;)


More information about the antlr-interest mailing list