[antlr-interest] Code too large, java error
Gustaf Johansson
gustaf.j at gmail.com
Tue Jun 30 04:26:34 PDT 2009
Hello,
I have implemented the grammar for a fairly complex language, using it's BNF
definition as base.
(Basically just reformatting the syntax to match Antlr).
Now this worked fine although the generated java code got pretty large,
~60´000 lines in the parser and ~7´500 in the lexer.
Now there has arrived a new revision of the language and i started to
implement the additions and changes and thats where i hit the wall.
Using just plain Antlr and generate a non-debug version works as before, but
in AntlrWorks when generating a debug version i get:
[12:56:12] C:\antlr\output\ExtendedParser.java:15: code too large
[12:56:12] public static final String[] tokenNames = new String[] {
[12:56:12] ^
[12:56:12] 1 error
The debug versions are ~85´500 lines in the parser and ~7´800 lines in the
lexer.
If i comment out the "tokenNames" and "ruleNames" string and the
"getTokenNames" function it compiles and runs, but id rather not do this
manually each time i compile.
So i wounder if there is some way to break these strings into smaller pieces
in Antlr or some way to get around this limitation in Java?
I really like to retain as much 1:1 syntax with the language's BNF since i
need to trust that the parser is correct.
The parser grammar is ~900 lines with comments.
BR Gustaf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090630/98f71133/attachment.html
More information about the antlr-interest
mailing list