Using precedence in Bison for unary minus doesn't solve shift/reduce conflict
问题 I'm devising a very simple grammar, where I use the unary minus operand. However, I get a shift/reduce conflict. In the Bison manual, and everywhere else I look, it says that I should define a new token and give it higher precedence than the binary minus operand, and then use "%prec TOKEN" in the rule. I've done that, but I still get the warning. Why? I'm using bison (GNU Bison) 2.4.1. The grammar is shown below: %{ #include <string> extern "C" int yylex(void); %} %union { std::string token;