[Top][All Lists]

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

Re: How to change default outcome of shift/reduce conflict?

From: Hans Aberg
Subject: Re: How to change default outcome of shift/reduce conflict?
Date: Mon, 14 Jan 2002 13:30:48 +0100

At 06:55 -0500 2002/01/14, Anthony DeRobertis wrote:
>KISS => keep is simple, stupid [no insult intended, read it the
>other way]

I think that the ASS (Accurate Structured Software) comes first; then those
of you so inclined may KISS that ASS.

>Yes. An incorrect 'solution' doesn't work, and thus isn't really
>much of a solution.

So, returning to the thread topic, in view of the ambiguity of the grammar
presented, I think that one should first pin down that ambiguity and the
ensuing semantics problem before looking for quick fixes merely intended to
push it through.

Specifically, in the rule
  x -> ANSWER expr WITH expr OR expr
is "OR" allowed in the "expr" of the "ANSWER expr WITH" part?

And, how do you want
  ANSWER expr WITH expr OR expr OR expr OR expr
to be interpreted? Possibilities:
  ANSWER expr WITH (expr OR expr) OR (expr OR expr)
  (ANSWER expr WITH expr OR expr) OR expr OR expr
  ANSWER expr WITH expr OR (expr OR expr OR expr)
Or does it not matter, because the semantics is the same?

When you know those things, you will know what to plug into your Bison .y file.

>> There are different styles of handling this problem. One is trying to alter
>> the shift to reduce somehow; I think that the Bison manual say something
>> about that (in the section about IF ... THEN ... ELSE).
>Lookin in the "Shift/Reduce" section of "Algorithm", I don't see anything to
>this effect.

Have you looked into section 5.2, "Shift/Reduce Conflicts"?

  Hans Aberg

reply via email to

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