[antlr-interest] specialStateTransition too big for Java (AntLR3)

Miguel Ping miguel.ping at gmail.com
Fri May 4 02:28:19 PDT 2007


Hi,

The problem is common and it has to do with the generated method tht
is is too big.
In fact, found this on the jvm spec:
http://java.sun.com/docs/books/jvms/second_edition/html/ClassFile.doc.html
(..)
The static constraints on the instructions in the code array are as follows:
    * The value of the code_length item must be less than 65536.
(...)

You can break the rule that's giving you that error in two rules. I
just though on posting the jvm spec here so people don't think it's a
antlr error, but instead a feature specified by the jvm spec.

Greetings,
Miguel Ping

On 5/4/07, Ruben Fonseca <rubenfonseca at di.uminho.pt> wrote:
> Hi!
>
> I'm using AntLR3 to build a PHP parser. I need to get rid of HTML. In
> order to do this I implemented a syntatic predicate on my Lexer, to see
> if I'm getting HTML or PHP tokens (see an example
> http://svn.perl.org/viewcvs/parrot/trunk/languages/plumhead/src/antlr3/Plumhead.g?view=markup
> )
>
> The problem is that when I generate the Java code with AntLR3, I can't
> compile the code, because of the following error:
>
> The code of method specialStateTransition(int, IntStream) is exceeding
> the 65535 bytes limit	WebAppViewer/antlr3/php	phpLexer.java	line 3894
>
> I'm guessing my Lexer is too complex or has too many tokens? Does anyone
> experienced the same problem before? Thanks for the advice.
>
> Ruben.
>
>
>


More information about the antlr-interest mailing list