help-bison
[Top][All Lists]
Advanced

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

Re: Tell a rule to shift instead of reduce?


From: Akim Demaille
Subject: Re: Tell a rule to shift instead of reduce?
Date: Sun, 22 Dec 2013 20:35:26 +0100

Le 22 déc. 2013 à 18:40, Adam Smalin <address@hidden> a écrit :

> I forgot to CC this to the group a few days ago.
> 
> >The token precedences apply to the tokens immediately before and after the 
> >parsing ‘.’ (as in the .output file) in the shift/reduce conflicting rules. 
> >The grammar must be written so that the tokens appear in such a position.
> 
> | rval '=' rval %prec '.' ',' rval

That's bad style, move your "%prec '.'" at the end of the rule.
It means the same, but it's clearer.  And therefore notice that
now, this rule has the precedence of '.', not that of '='.

> conflict file:
> 
> 
> rval '=' rval . ',' rval
> Conflict between rule 343 and token ',' resolved as reduce (',' < '=').

So it's bizarre that in that conditions bison still refers to '='.

> Shouldn't it have worked? I tried putting %prec at the end of the line and 
> after the ',' as well and it failed. I tried multiple places at once and got 
> an error saying only one %prec per line.

Please, post a self contained and minimal example.


reply via email to

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