[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: rule cycle and reduce/reduce conflict
From: |
Hans Aberg |
Subject: |
Re: rule cycle and reduce/reduce conflict |
Date: |
Tue, 19 Nov 2013 14:55:57 +0100 |
On 19 Nov 2013, at 09:50, Florent Teichteil <address@hidden> wrote:
> One question though: why do the precedence levels of operators '!' and
> '=' defined at the beginning of my grammar don't apply in this case?
> Moreover, I thought that ambiguous associativity was more likely to
> create shift/reduce conflicts rather than reduce/reduce conflicts,
> wasn't it?
Bison uses token precedences, which operate on the token immediately before and
after the parsing dot in the conflicting shift/reduce conflict, as in the
.output file.
A simple way to get started is modifying the calculator example in the Bison
manual, sec. 2.2 and 2.5.1, which is also in the distribution directory
“examples”. There is a C++ example, too, sec. 10.1.6.1.
(Assignment has normally right associativity or none, and lower precedence than
the other operators, coming earlier in the grammar declarations.)
Hans