[antlr-interest] solution to lexer issue

Wincent Colaiuta win at wincent.com
Thu Oct 25 05:44:27 PDT 2007


El 25/10/2007, a las 10:02, Terence Parr <parrt at cs.usfca.edu> escribió:

> Solution is to change my assumption that any char can follow a token
> (some of you don't believe me that is the problem but it is).
> Anyhoo, if I assume valid input now instead

I think you've hit the nail on the head right there. And assuming  
valid input is coherent with how ANTLR already behaves (ie. it builds  
*predictive* recognizers that make those predictions based on the  
assumption that the input is valid).

> Note that all three examples are ambiguous. Same input, different
> rules can match.

I presume you're using the ordering of the rules as an external  
constraint to disambiguate them, right?

Cheers,
Wincent




More information about the antlr-interest mailing list