[Top][All Lists]

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

Re: POSIX and reduce/reduce conflicts

From: Akim Demaille
Subject: Re: POSIX and reduce/reduce conflicts
Date: 09 Apr 2002 10:35:46 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Common Lisp)

>>>>> "Paul" == Paul Eggert <address@hidden> writes:

>> From: Akim Demaille <address@hidden> Date: 08 Apr 2002 23:24:02
>> +0200
Paul> Also, when there is a reduce/reduce conflict, yacc must reduce
Paul> by the grammar rule that occurs earliest in the input.
>> So using the highest priority is a POSIX violation.

Paul> I wasn't counting that as a conflict.  Sorry, I should have made
Paul> that clear.  

Me too...

Paul> My quotation above is rule 4 of how to apply precedences and
Paul> associativities.  Rules (1) covers priorities, and has the
Paul> expected and traditional effect.

Paul> The standard also says:

Paul> "Conflicts resolved by precedence or associativity shall not be
Paul> counted in the shift/reduce and reduce/reduce conflicts reported
Paul> by yacc on either standard error or in the description file."

Actually, I still don't have the explicit answer to my question, it is
left implicit, but I'd rather make sure...  Sorry not having asked
more precisely since the beginning:

Bison, in case of a reduce/reduce conflict _always_ picks up the first
rule, no matter what precedence the rules have.  The idea was once
raised to use precedence to help in case of conflicts.  Does POSIX
allow this?

It might be a very bad idea, given that it mildly gives some
validity to RR conflicts, which are always _bad_ and should be killed
by means of grammar transformations rather than mere precedence
tweaking.  But if some day Bison supports other paradigms, such as
back tracking, then precedence can be seen as a means to order the
search, which can be good.

Hm.  I realize it is not clear to me whether this (using precedence in
RR conflicts) is a feature, or a misfeature.

reply via email to

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