[antlr-interest] ANTLR3 Large Grammar Issue

Terence Parr parrt at cs.usfca.edu
Wed Nov 28 11:11:01 PST 2007


On Nov 28, 2007, at 9:16 AM, 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?

hi :)

no, but javac has limits.

> 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.

3.1 has grammar delegation/import.  coming soon to a theatre near you.

Ter


More information about the antlr-interest mailing list