I either don't understand shift/reduce yet, or I don't understand
%prec. I believe the conflict in my grammar is that it can't decide
whether -a(b) is -(a(b)) or (-a)(b), which I thought using %prec would
solve. The essence of it is below, along with the corresponding
section of the output file:

%left NEG
%left FUNCALL

%%

input:
/* empty */
| input exp SEMICOLON
;

exp:
  ID
| MINUS exp %prec NEG
| exp LPAREN exp RPAREN %prec FUNCALL
;

7: shift/reduce conflict (shift 9, reduce 4) on LPAREN
state 7
        exp : MINUS exp .  (4)
        exp : exp . LPAREN exp RPAREN  (5)

        LPAREN  shift 9
        SEMICOLON  reduce 4
        RPAREN  reduce 4

-- 
Tom Lieber
http://AllTom.com/


_______________________________________________
help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison

Reply via email to