[antlr-interest] Puzzling Problem - The Sequel

Sam Barnett-Cormack sdb at geekworld.co.uk
Mon Apr 10 05:00:07 PDT 2006


So, that problem went away, and silly errors in the rest of my code got
fixed, and then I discovered a change in the spec for that data file,
requiring me to accept and discard a line starting with a hash before
any polygon (before a 0 or -99999 line).

So, as can be seen in the new versions of the files at
http://shed.geekworld.co.uk/~sdb/jguru/antlr/, the building rule has become

building returns [Vector<Vector<Floatpair>> data = new
Vector<Vector<Floatpair>>()]
  { Vector<Floatpair> pairs = null; }
  : (hashline)?
    pairs=build_polygon { data.add(pairs); }
    ((hashline)? pairs=cavity_polygon { data.add(pairs); })*
  ;

Unfortunately, this suddenly causes a bizarre nondeterminism error in
cavity_polygon, on the ()+ rule, of a nondeterminism upon k==1:HASH,
k==2:just-about-anything. This doesn't make much sense, as the exit
branch of the subrule should only be END. So, I'm confused.

Anyone able to shed any light on this? I'm particularly confused as to
how the nondeterminism appeared in a rule that hadn't changed, due to a
change in another rule...

Sam


More information about the antlr-interest mailing list