1: /* @(#)cpy.y 2.1 SCCS id keyword */ 2: %term number stop DEFINED 3: %term EQ NE LE GE LS RS 4: %term ANDAND OROR 5: %left ',' 6: %right '=' 7: %right '?' ':' 8: %left OROR 9: %left ANDAND 10: %left '|' '^' 11: %left '&' 12: %binary EQ NE 13: %binary '<' '>' LE GE 14: %left LS RS 15: %left '+' '-' 16: %left '*' '/' '%' 17: %right '!' '~' UMINUS 18: %left '(' '.' 19: %% 20: S: e stop ={return($1);} 21: 22: 23: e: e '*' e 24: ={$$ = $1 * $3;} 25: | e '/' e 26: ={$$ = $1 / $3;} 27: | e '%' e 28: ={$$ = $1 % $3;} 29: | e '+' e 30: ={$$ = $1 + $3;} 31: | e '-' e 32: ={$$ = $1 - $3;} 33: | e LS e 34: ={$$ = $1 << $3;} 35: | e RS e 36: ={$$ = $1 >> $3;} 37: | e '<' e 38: ={$$ = $1 < $3;} 39: | e '>' e 40: ={$$ = $1 > $3;} 41: | e LE e 42: ={$$ = $1 <= $3;} 43: | e GE e 44: ={$$ = $1 >= $3;} 45: | e EQ e 46: ={$$ = $1 == $3;} 47: | e NE e 48: ={$$ = $1 != $3;} 49: | e '&' e 50: ={$$ = $1 & $3;} 51: | e '^' e 52: ={$$ = $1 ^ $3;} 53: | e '|' e 54: ={$$ = $1 | $3;} 55: | e ANDAND e 56: ={$$ = $1 && $3;} 57: | e OROR e 58: ={$$ = $1 || $3;} 59: | e '?' e ':' e 60: ={$$ = $1 ? $3 : $5;} 61: | e ',' e 62: ={$$ = $3;} 63: | term 64: ={$$ = $1;} 65: term: 66: '-' term %prec UMINUS 67: ={$$ = -$2;} 68: | '!' term 69: ={$$ = !$2;} 70: | '~' term 71: ={$$ = ~$2;} 72: | '(' e ')' 73: ={$$ = $2;} 74: | DEFINED '(' number ')' 75: ={$$= $3;} 76: | DEFINED number 77: ={$$ = $2;} 78: | number 79: ={$$= $1;} 80: %% 81: # include "yylex.c"