Simple ambiguous grammar with reduce-reduce conflict
问题 The following simple grammar to parse a logical expression results in a reduce/reduce conflict: %token AND OR %token NUMBER VARIABLE %% logical_expr : logical_expr AND logical_term | logical_expr OR logical_term | logical_term ; logical_term : VARIABLE | comparison | '(' logical_expr ')' ; comparison : expr '<' expr | expr '>' expr ; expr : expr '+' term | expr '-' term | term ; term : NUMBER | VARIABLE | '(' expr ')' ; %% The status report from bison has: state 2 4 logical_term: VARIABLE .