|
What happens if we have a shift/reduce conflict between token a `t` and some rule, when the precedences of the `t` and the rule are equal, but their associativity is different? |
This cannot happen. In order for them to have the same precedence, the precedence of the rule must correspond to some token, say `r`, that was declared on the same line as `t`. Since `t` and `r` were declared on the same line, they must also have the same associativity. This means the associativity of the rule and the associativity of `t` must be the same if they have the same precedence.
Note that when using %prec to change the precedence of a rule, it also affects its associativity.
|
|