[antlr-interest] BUG? (JAVA) Antlr complains, and possibly fails, when dealing with large acceptance sets

Terence Parr parrt at cs.usfca.edu
Fri Nov 9 17:39:06 PST 2007


On Nov 8, 2007, at 10:03 PM, Austin Hastings wrote:

> Antlr-godz,
>
> In reference to my email earlier tonight (see below), I replaced  
> this rule:
>
>
> WS    : ({ Character.isWhitespace(input.LA(1)) }? .)+    {$channel  
> = HIDDEN;} ;
>
>
> with this one:
>
>
> WS: (' ' | '\t' | '\r' | '\n' )+ {$channel = HIDDEN;} ;
>
>
> This change made the complaint stop. I am guessing that somewhere  
> in the bowels of antlr it was trying to expand the '.' dfa, but  
> that doesn't make much sense because there's plenty of other times  
> when '.' gets used. So I really don't know what it was doing - but  
> enumerating the "easy" whitespace characters made it stop. I don't  
> know if this is a bug or not - it may be the case that running with  
> -mx allTheRamInTheWorld might have let it succeed.

Hi Austin :)  Heh, is your grammar pretty big?  Seems that I've done  
something similar for the java.g once, but ended up enumerating chars  
for speed.  Hmm...yeah, matching any sequence of char can really piss  
antlr off at the moment.  Actually, you'll need {...}?=> not just  
{...}?.  Can u try that?

Ter



More information about the antlr-interest mailing list