[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Misunderstanding %prec?
From: |
Tom Lieber |
Subject: |
Misunderstanding %prec? |
Date: |
Sat, 24 Jan 2009 21:16:29 -0500 |
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/
- Misunderstanding %prec?,
Tom Lieber <=