[antlr-interest] Solution for specialStateTransition exceeding 65k
Jim Idle
jimi at temporal-wave.com
Thu May 27 06:50:56 PDT 2010
There is quite often a way to rejig the lexer to avoid the huge expansion, if you post your grammar, maybe we can help. I think that such issues will go away in v4 :-)
Jim
> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Marcus Klimstra
> Sent: Thursday, May 27, 2010 2:19 AM
> To: antlr-interest at antlr.org
> Subject: [antlr-interest] Solution for specialStateTransition exceeding
> 65k
>
> Hi,
>
> I ran into the problem of the huge specialStateTransition bytecode size
> when using many gated semantic predicates in the lexer (in all my lexer
> rules actually). After a google search I found that this is a known
> issue to which there are some workarounds, but no real solutions. At
> first I used the workaround to manually add local variables for the
> outer-class references, but at some point even that no longer worked.
> Therefore I changed the Java code generator to create seperate methods
> for each switch-case. This works quite well for me, so I wanted to
> share it with the community. Note that I only tested this in the lexer,
> since my parser has no specialStateTransition-method at the moment. I
> also added annotations to suppress the useless warnings in the
> generated code. A diff-file with these changes is attached.
>
> - Marcus
More information about the antlr-interest
mailing list