Hi.
Given the following operators:
%left '+' '-'
/*...*/
%right SOME_UNARY_OPERATOR
%left STRING_CONCATENATION
And the following rules:
integer:
SOME_UNARY_OPERATOR string ;
string:
STRING |
string '+' string %prec STRING_CONCATENATION ;
Bison can't figure out the correct precedence for "string '+' string",
and no matter what I do, the report insists that ('+' <
STRING_CONCATENATION), which is a problem because it understands the
string (SOME_UNARY_OPERATOR "str"+"ing") as ((SOME_UNARY_OPERATOR
"str")+"ing"), which is a syntax error.
However, if I leave out the first '+' (the one just above the /*...*/),
it finally works as it should.
I can also get around it if I change the troublesome rule to
STRING '+' string %prec STRING_CONCATENATION
That forces Bison to delay the reduction of the rule, but at the cost of
stack space.
Is this a bug or am I doing something wrong?