help-bison
[Top][All Lists]
Advanced

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

Re: Midrule semantic ambiguity warning


From: Hans Aberg
Subject: Re: Midrule semantic ambiguity warning
Date: Thu, 7 Dec 2000 12:15:19 +0100

At 11:01 +0100 0-12-07, Akim Demaille wrote:
>Hans> A suggest (for the future): Bison is given the capability of
>Hans> issuing a "possible midrule semantic ambiguity" in the case a
>Hans> midrule action appears in such a way that the lookahead token
>Hans> passes over more than one midrule action before it can make a
>Hans> choice of which rule to execute. (Cf. Bison manual, 3.5.5.)
>
>That's a good idea.  How do you plan to implement it?  :)

Well, Bison cannot determine whether a semantic ambiguity takes place, but
I figure the information that it passes over two midrule actions must be
somehow available when Bison resolves which rules to take.

The ambiguity can be detected, I think, if one assigns every midrule action
the same token action:
<var>:
    <var11> { ma11 } <var12> ... { a1 }
  | <var21> { ma21 } <var22> ... { a2 }
translates into internal
%token midrule_action
<var>:
    <var11> midrule_action <var12> ... { a1 }
  | <var21> midrule_action <var22> ... { a2 }
and if that produces any Bison translation conflicts, one gets a "possible
semantic ambiguity" warning.

-- I am not positively sure the above idea is correct, though.

Here is another idea:

Midrule actions (by a Bison option) must be written using [...] instead of
{...}: The thing is that currently Bison cannot detect a forgotten "|" as
it will then merely assume one is indicating midrule actions instead of a
series of rules. So somehow, Bison should be able to know when a rule is
terminated, which can be done by this suggest.

I realize when I am writing this that it does not help the case when the
{...} is excluded. So this is an input on the level of ideas then.

  Hans Aberg





reply via email to

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