Antlr3 64K “code too large for try statement”

265 views
Skip to first unread message

Warren Stringer

unread,
Jun 18, 2014, 4:27:13 PM6/18/14
to antlr-di...@googlegroups.com
Hi, 

Am porting from the Antlr3 C runtime to Antlr3 Java runtime 

Antlr v3.4 EventParser.c is working fine - about 7MB
Antlr v3.52 EventParser.java generates many “code too large for try statement” errors - on a 1.4MB file

Any workarounds, without refactoring the grammar?

Thanks!

Warren

Terence Parr

unread,
Jun 18, 2014, 4:31:59 PM6/18/14
to antlr-di...@googlegroups.com
rules were too many alternatives can result in really big methods. just break up the rules so that some of the alternatives are in a different rule.

a : X | Y | Z ;

becomes

a : X | b ;

b : Y | Z ;

Ter
> --
> You received this message because you are subscribed to the Google Groups "antlr-discussion" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to antlr-discussi...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Warren Stringer

unread,
Jun 18, 2014, 6:58:00 PM6/18/14
to antlr-di...@googlegroups.com
Wow Ter, can you answer any quicker than that? I mean - geez - 4 minutes with a solution. I guess you could start answering questions *before* they're asked.

The C runtime version works and passes all the regression tests. Just handed off to my colleague to generate the Java version. Very cool; thanks!

Terence Parr

unread,
Jun 18, 2014, 7:35:59 PM6/18/14
to antlr-di...@googlegroups.com

On Jun 18, 2014, at 3:57 PM, Warren Stringer <war...@tempo.ai> wrote:

> Wow Ter, can you answer any quicker than that? I mean - geez - 4 minutes with a solution. I guess you could start answering questions *before* they're asked.

I could, but I charge for those ;)

>
> The C runtime version works and passes all the regression tests. Just handed off to my colleague to generate the Java version. Very cool; thanks!

Glad the C output works. I’m never sure what state it’s in.
T
>
> On Wednesday, June 18, 2014 1:27:13 PM UTC-7, Warren Stringer wrote:
> Hi,
>
> Am porting from the Antlr3 C runtime to Antlr3 Java runtime
>
> Antlr v3.4 EventParser.c is working fine - about 7MB
> Antlr v3.52 EventParser.java generates many “code too large for try statement” errors - on a 1.4MB file
>
> Any workarounds, without refactoring the grammar?
>
> Thanks!
>
> Warren
>

Warren Stringer

unread,
Jul 30, 2014, 6:55:15 PM7/30/14
to antlr-di...@googlegroups.com
Am back from vacation. 

The C runtime version works and passes all the regression tests. Just handed off to my colleague to generate the Java version. Very cool; thanks!

Glad the C output works. I'm never sure what state it's in.
T


Without the C version, we would have had to roll our own, without the benefit of a fast port to Java platforms. 

The issues with the C version were due mostly to expanding parser file size, when attempting statements like:
  
   a: b? c;

This is a roundabout way of saying that the C version is workable. Kudos again to Jim Idle for making Antlr3 our best choice. 

w






Jim Idle

unread,
Jul 31, 2014, 5:07:59 AM7/31/14
to antlr-di...@googlegroups.com
Nice to see. Thanks for the feedback! Now if only I could find the time to have a go at v4 C++, and I would like to give swift a go too. Maybe after the summer.


Reply all
Reply to author
Forward
0 new messages