Search code examples
parsinggrammarantlr3antlrworks

problem antlrworks code too large


In Antlrworks I get this error:

 [18:21:03] Checking Grammar Grammar.g...
 [18:21:26] Grammar.java:12: code too large
 [18:21:26]     public static final String[] tokenNames = new String[] {
 [18:21:26]                                  ^
 [18:21:26] 1 error

Using instead the generated code in a Java project works normally. What can be had this problem?

Thanks.


Solution

  • For larger grammars, it's easier to split your grammar into bite-sized chunks (at least a separate lexer and parser). If you do so, ANTLRWorks will probably stop complaining as well.

    Checkout the Wiki entry about "Composite grammars".