[antlr-interest] Understanding priorities in lexing (newbie)

Terence Parr parrt at cs.usfca.edu
Thu Jul 12 16:23:05 PDT 2007


On Jul 12, 2007, at 4:07 PM, Micheal J wrote:
>> Yes.  ANTLR doesn't do the natural thing here.  For normal cases,
>> it's not an issue.  Few tokens are prefixes like that.
>> Normally it's
>> keyword against 'a'..'z'+ not 'a'..'z'.
>
> What would it take to alter the prediction strategy/algo to do the  
> "natural
> thing" even in the presence of token prefixes like these?
>
> Just trying to get an idea of the work involved. I can see how this  
> might be
> an issue to some.

It's hard in a recur. desc. parser because you have to longjump from  
one method to another.  Note sure how it could be done without  
merging rules.

Maybe I could look into doing the (...)* not (...) for implicit  
Tokens rule to see if it generates more "correct" DFA?

Ter



More information about the antlr-interest mailing list