[antlr-interest] ANTLR3 Large Grammar Issue

Andreas Bartho andreas.bartho at inf.tu-dresden.de
Wed Nov 28 09:34:50 PST 2007


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