yacc problem
I have two productions:
F: F '+' G {$$=$1+$3;}
| F '-' G {$$=$1-$3;}
| G {$$=$1;}
;
........
........
K: L '+''+' {
/*if($3=='+')*/
/*{*/
$$=$1++;
/*}*/
/*else*/
/*{*/
/*$$=$1;*/
/*}*/
/*printf("%d",$3);}*/
The problem I am having is that when I enter 4++, the bottom production catches it which is OK, but if I enter 4+4 then it catches in the bottom prodution and errors out. I tried checking $3 but it errors on me saying that '+' is untyped. How can I overcome this?
|