[antlr-interest] Help Needed with multiple alternatives

Jim Idle jimi at temporal-wave.com
Tue Feb 26 10:11:55 PST 2008


Well, as you can see, it is this sort of thing that to be honest you 
only pick up on through experience really. Hopefully, discussion on the 
list helps everyone. 

Hence, I see your point about relating the diagrams to concrete cases, 
but I think that it might already be doing this as well as it might 
because it is telling you about the terminals that kick in at the start 
of expr. To reliably refer to the ambiguity in terms of the following 
rule may be difficult and may well not help you. I admit that I 
personally have not thought about that too much, maybe Ter has. The 
diagram, to me at least, seems to clearly explain which rules the 
terminals are being reached via, but I understand that some time is 
required to start picking up on that. I bet that the OP will know how to 
read it in future though! :-)

It's like the scene in the Matrix where the guy says "I dont even see 
the code anymore, just blond, brunette...". After a while you see past 
the error to the root of the problem without thinking on it too much.

Jim


> -----Original Message-----
> From: shmuel siegel [mailto:antlr at shmuelhome.mine.nu]
> Sent: Tuesday, February 26, 2008 9:55 AM
> To: Jim Idle
> Cc: antlr-interest at antlr.org
> Subject: Re: [antlr-interest] Help Needed with multiple alternatives
> 
> Jim Idle wrote:
> > ...
> >
> >
> >
> > In your grammar, the operators it is complaining of can associate
> with
> > the expr that ends the let expr, which is probably what you are
> > expecting, or the expr that contains the let as an expr. Your 
grammar
> > allows let to be the expr that is part of a let, so you can have let
> x
> > in let y in let b in g ->yyyy  etc . SO, which let clause did you
> mean
> > it to belong to? That is what ANTLR is telling you.
> >
> >
> >
> > Jim
> >
> >
> >
> Jim,
> I congratulate you on being able to construct a concrete case that
> exhibits the ambiguity. I couldn't do it. Could ANTLR be modified to
> output such concrete examples?
> 




More information about the antlr-interest mailing list