[antlr-interest] ArrayIndexOutOfBoundsException while generating code in v3
Kay Roepke
kroepke at classdump.org
Mon Sep 25 03:31:54 PDT 2006
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
More information about the antlr-interest
mailing list