help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Ambiguous Grammar


From: Hans Aberg
Subject: Re: Ambiguous Grammar
Date: Tue, 27 May 2003 10:34:40 +0200

At 07:51 +0530 2003/05/27, Ramaswamy wrote:
>    Hi,     Thanks first. It is a  mistake if I mentioned that A, B, C are
>tokens. They are productions and  effectively A B = C, in terms of the
>tokens.       If I were to use  non-glr it would probably work. But since
>GLR does both the shift and reduce by  splitting the stack I get an
>ambiguity. And since A, B & C are not tokens I  cannot use the precedence
>for the same. The problem I am facing is that I dont  seem to get where to
>add the %dprec to get it working. Observe the following  ambiguity that
>the parser prints -
>  Ambiguity detected.
...
>        As u might be observing the  production Setting is the culprit
>having the A | B and the A B form. I'm still  working on where to put the
>%dprec. In case there are any ue in this regard, do  send it across. Bye.
>  Regds Ram  

I do not know so much about GLR, so you should perhaps wait for somebody
else to come forth.

But from the Bison manual, GLR and %dprec seems to be most useful when one
needs the parser to dynamically decide which branch to accept. The .output
file should tell which states that have this ambiguity, and from it you
should be able work out which rules to put the %dprec stuff.

You haven't supplied enough of your grammar so that one can see what cases
the shift reduce problem or what you expect the parse to be. So it is not
possible at least for me to give more input.

  Hans Aberg






reply via email to

[Prev in Thread] Current Thread [Next in Thread]