Re: rule cycle and reduce/reduce conflict

2013-11-19 Thread Hans Aberg
On 19 Nov 2013, at 09:50, Florent Teichteil 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

Re: rule cycle and reduce/reduce conflict

2013-11-19 Thread Akim Demaille
Le 18 nov. 2013 à 22:17, Florent Teichteil a écrit : > Hi all, > > I am new to bison and would need your kind help to understand why the > following (stupid) simple grammar is ambiguous: Actually your question is why the conflict remains. > %left '!' > %left '=' > > %% > > start : bool_exp

Re: rule cycle and reduce/reduce conflict

2013-11-19 Thread John P. Hartmann
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

Re: rule cycle and reduce/reduce conflict

2013-11-19 Thread Florent Teichteil
> ! 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

Re: rule cycle and reduce/reduce conflict

2013-11-19 Thread John P. Hartmann
! is a prefix operator; = is infix. On 11/19/2013 09:50 AM, Florent Teichteil wrote: > Thanks John! > 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

Re: rule cycle and reduce/reduce conflict

2013-11-19 Thread Florent Teichteil
Thanks John! 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?

Re: rule cycle and reduce/reduce conflict

2013-11-18 Thread John Levine
>bool_expr : '!' bool_expr > | num_expr '=' num_expr > | 'b' > ; > >num_expr : bool_expr > | 'n' > ; Yes, this is ambiguous. If your input is "!b=n", it can't tell which of these you mean: ! ( b = n ) (!b) = n R's, John __

rule cycle and reduce/reduce conflict

2013-11-18 Thread Florent Teichteil
Hi all, I am new to bison and would need your kind help to understand why the following (stupid) simple grammar is ambiguous: %left '!' %left '=' %% start : bool_expr ; bool_expr : '!' bool_expr | num_expr '=' num_expr | 'b' ; num_expr : bool_expr | 'n'