help-bison
[Top][All Lists]
Advanced

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

Mysterious Reduce/Reduce Conflicts


From: Reza Roboubi
Subject: Mysterious Reduce/Reduce Conflicts
Date: Thu, 08 Aug 2002 14:03:35 -0700

I have trouble understanding this part of the bison manual on
"Mysterious Reduce/Reduce Conflicts:"

http://www.gnu.org/manual/bison-1.35/html_node/Mystery-Conflicts.html#Mystery%20Conflicts

The manual says:  

" In this grammar, two contexts, that after an ID at the beginning of a
param_spec and likewise at the beginning of a return_spec, are similar
enough that Bison assumes they are the same. "

and suggests fixing the problem by adding a "bogus" rule:

return_spec:
             type
        |    name ':' type
        /* This rule is never used.  */
        |    ID BOGUS
        ;

the manual explains:

" This corrects the problem because it introduces the possibility of an
additional active rule in the context after the ID at the beginning of
return_spec. This rule is not active in the corresponding context in a
param_spec, so the two contexts receive distinct parser states. "

My confusion is this:

If bison only needs some non-active visual queue to know that it must
generate different parser states for the two contexts, why does bison
not simply take into account the fact that the two rules have different
names?  Why is this not enough to distinguish their associated contexts?

I'd greatly appreciate your help.  I believe that understanding this
will help me better understand how bison works and what it exactly does.

Thanks.



reply via email to

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