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

Austin Hastings Austin_Hastings at Yahoo.com
Fri Nov 9 20:12:29 PST 2007


Terence,

The grammar is fairly small - an emended version of the gunit grammar. 
Adding => didn't seem to have any impact. I'm still getting this:

   [antlr3] error(10):  internal error: Can't get property 
javaCompressedTransition using method get/isJavaCompressedTransition 
from org.antlr.analysis.DFA instance : java.lang.OutOfMemoryError: Java 
heap space
   [antlr3] java.util.ArrayList.<init>(ArrayList.java:112)
   [antlr3] org.antlr.analysis.DFA.getRunLengthEncoding(DFA.java:423)
   [antlr3] org.antlr.analysis.DFA.getJavaCompressedTransition(DFA.java:399)
   [antlr3] sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   [antlr3] 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   [antlr3] 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   [antlr3] java.lang.reflect.Method.invoke(Method.java:597)
   [antlr3] 
org.antlr.stringtemplate.language.ASTExpr.invokeMethod(ASTExpr.java:563)
   [antlr3] 
org.antlr.stringtemplate.language.ASTExpr.rawGetObjectProperty(ASTExpr.java:513)
   [antlr3] 
org.antlr.stringtemplate.language.ASTExpr.getObjectProperty(ASTExpr.java:420)
   [antlr3] 
org.antlr.stringtemplate.language.ActionEvaluator.attribute(ActionEvaluator.java:346)
   [antlr3] 
org.antlr.stringtemplate.language.ActionEvaluator.expr(ActionEvaluator.java:131)
   [antlr3] 
org.antlr.stringtemplate.language.ActionEvaluator.templateApplication(ActionEvaluator.java:211)
   [antlr3] 
org.antlr.stringtemplate.language.ActionEvaluator.expr(ActionEvaluator.java:121)

It's back to enumerated characters for me. :(

=Austin


Terence Parr wrote:
>
> 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