The 64K syndrome: The code for the static initializer is exceeding the 65535 bytes limit

Skip to end of metadata
Go to start of metadata

This limitation is a pure JVM limitation that does not support a static initializer code greater than 64K. While a grammar can produces with antlr3 relatively small DFAs, the cumulated size of each DFAs static initializer within a single parser/lexer class can overpass the 64k limitation.

One solution is to extract all DFAs from the main parser or lexer classes and put them into a separate directory namely

<grammar directory>/lexer

<grammar directory>/parser

 

If your are using a SharedState for your grammar, you should add its type in the options block as

options {

    SharedStateType=SharedState;

}

 

The patch for applying this technique is delivered by the 2 joined jars antlr-3.4.1-SNAPSHOT.jar and antlr-runtime-3.4.1-SNAPSHOT.jar

This is not an official patch, nor it has been approved by Terr. So if you like it while it solve the 64k syndrome for your grammar... just push it to the dictator...

 

Labels: