[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: rule cycle and reduce/reduce conflict
From: |
John P. Hartmann |
Subject: |
Re: rule cycle and reduce/reduce conflict |
Date: |
Tue, 19 Nov 2013 11:51:48 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130625 Thunderbird/17.0.7 |
You'll have to learn to decipher the grammar output file. Perhaps the
problem is the rule
num_expr : bool_expr
You are welcome to send me the output file as a mail attachment off his
list.
On 11/19/2013 11:40 AM, Florent Teichteil wrote:
>> ! is a prefix operator; = is infix.
>
> Sorry, but I read bison's documentation regarding infix operators and
> precedence levels, and I still don't understand your short explanation.
> Here is another simple grammar with only infix operators that has conflicts:
>
> %left '&'
> %left '='
> %left '+'
>
> %%
>
> start : bool_expr;
>
> bool_expr : bool_expr '&' bool_expr
> | num_expr '=' num_expr
> | 'b'
> ;
>
> num_expr : bool_expr
> | num_expr '+' num_expr
> | 'n'
> ;
>
> %%
>
> All operators have defined precedence levels, so why is it ambiguous?
>
> Thanks,
> Florent
>