[antlr-interest] ANTLR3 Large Grammar Issue

Daniel Rippel drippel at yahoo.com
Wed Nov 28 11:00:15 PST 2007


That hack works.

I cut and pasted the following lexer rule verbatim at the end of my grammar, and now everything compiles nicely.
Kind of disconcerting.
STUPID_HACK
     :   'a'+ '.'
     ;

----- Original Message ----
From: Andreas Bartho <andreas.bartho at inf.tu-dresden.de>
To: Daniel Rippel <drippel at yahoo.com>
Cc: antlr-interest at antlr.org
Sent: Wednesday, November 28, 2007 12:34:50 PM
Subject: Re: [antlr-interest] ANTLR3 Large Grammar Issue


Hi,

I experienced the same, but no one could tell me why. Have a look here 
http://www.antlr.org/pipermail/antlr-interest/2007-September/023627.html

Maybe the presented hack helps you.

Andreas


Daniel Rippel wrote:
> I have a large grammar ~500 tokens.  My target language is Java.
> 
> After I run antlr to generate my Lexer.  
> The Lexer fails to compile with the following error:
> 
> TestLexer.java:11428: code too large
>     public void mTokens() throws RecognitionException {
>                 ^
> 1 error
> 
> And indeed the mTokens function is 10000+ lines of code.
> I also noticed and tried the -Xnoinlinedfa option.  This just pushes
 the code too large issue over to the Parser class.
> 
> So, my question is:
> Is there an antlr3 limit on the size of grammars?
> 
> I also noticed that grammar inheritance is out in v3.  
> So, perhaps I can back up to v2 and break the grammar into smaller
 chunks that way.
> 
> 
> 
> 






More information about the antlr-interest mailing list