[antlr-interest] ArrayIndexOutOfBoundsException while generating code in v3

John Goering johnstephi at googlemail.com
Mon Sep 25 03:36:55 PDT 2006


OK, thanks!
That's right, I wanted ';' to be optional for the last statement. I changed
that now to:

statement? (SEMI statement)* SEMI?

which seems to work well. Is there an easier way than that?
John Goering

On 9/25/06, Kay Roepke <kroepke at classdump.org> wrote:
>
> Hi John!
>
> On 25. Sep 2006, at 11:49 Uhr, John Goering wrote:
>
> > Quick update: Taking out "EOF" (which I had not defined since I
> > thought it
> > was implicitly defined) and tinkering around with a few other
> > things (not
> > sure which ones helped) ended up causing the code to be able to be
> > generated, so it's no longer a problem for me, but probably still a
> > bug.
> > Could it have to do with the missing EOF token?
>
> Thank you very much for the simplified grammar! The problem is indeed
> the EOF token, but not that you didn't define it, but rather that ANTLR
> tries to insert it into the local FOLLOW set when it generates code.
>
> It tries to insert -1 in the corresponding bitset, which of course
> fails. Setting bit -1 doesn't seem to be a good idea ;)
> After a quick inspection, I don't see an obvious fix, but I'm sure
> Ter will ;)
>
> I add this to the bug list in the wiki.
>
> What exactly do you want to achieve with the program rule? My best
> guess is that you want the ';' to be optional for the last statement
> in the input,
> but the way it is written now, the EOF can never be reached (at least
> ANTLR warns to this effect before crashing badly... :))
>
> Thanks for the report!
>
> cheers,
> -k
>
> --
> Kay Röpke <kroepke at classdump.org>
> classdump Software
> Key fingerprint = A849 0F2C C322 4022 379E  8661 7E1B FE0D 4CD2 A6D0
>
>
>
>


-- 
"I love deadlines. I like the whooshing sound they make as they fly by." -
Douglas Adams
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20060925/a17c2103/attachment.html 


More information about the antlr-interest mailing list