[antlr-interest] Oh my, code too large

John Ridgway john at jacelridge.com
Thu Dec 13 13:04:43 PST 2007


The problem is real.  Java effectively limits you to 65KBytes per  
method of byte-code.  The source of the limit is the definition of  
the class files.  A class file includes, for each method, a table of  
exception handlers, and each of the entries in these tables includes  
the address (in bytes relative to the beginning of the method) of the  
beginning and end of the try-block, stored as two 16-bit integers.   
There is no way around this.  I hope that there are people out there  
who can make suggestions as to how to modify your lexer to generate  
less code.

Peace
- John


On Dec 13, 2007, at 2:51 PM, Andreas Ravnestad wrote:

> On 12/13/07, Andreas Ravnestad <andreas.ravnestad at gmail.com> wrote:
>> Sometimes ANTLR generates a lexer which will make javac choke on
>> itself with a message resembling this:
>>
>> src/no/ntnu/xqft/parse/XQFTLexer.java:14313: code too large
>>         public int specialStateTransition(int s, IntStream input)
>> throws NoViableAltException {
>>                    ^
>>
>> Any ideas how to get around this? Maybe a 64 bit operating system? :)
>>
>> -Andreas
>>
>
>
>
> And in related news:
>
> Exception in thread "main" java.lang.Error: Unresolved compilation  
> problem:
> 	The code of method sequenceType() is exceeding the 65535 bytes limit
>
> I hope christmas holidays will be here soon :(
>
> -Andreas



More information about the antlr-interest mailing list