[antlr-interest] ANTLR3 Large Grammar Issue

Daniel Rippel drippel at yahoo.com
Wed Nov 28 09:16:18 PST 2007


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