[antlr-interest] greedy vs nongreedy lexer rules

Terence Parr parrt at cs.usfca.edu
Sun Apr 18 16:18:57 PDT 2010


On Apr 18, 2010, at 4:15 PM, Marcin Rzeźnicki wrote:
> I am not sure whether it works: as far as I can remember I tried that
> and, looking at generated code, I realized that GUTS was not using
> 'follows' information so it didn't really know when to leave the loop.

Hmm...it should since it's a fragment rule. 

Well, either way, we'd need to duplicate the GUTS then (nongreedy in v3 or modes in v4).

Wow...this is a tough decision about how to do v4 lexers...I'd really like to avoid generating recursive-descent lexer code, sticking with a state machine.

Ter



More information about the antlr-interest mailing list