xref: /csrg-svn/old/cpp/cpy.y (revision 10084)
17979Srrh /*
2*10084Ssam  * @(#)cpy.y 1.2 01/02/83
37979Srrh  */
47979Srrh %term number stop DEFINED
57979Srrh %term EQ NE LE GE LS RS
67979Srrh %term ANDAND OROR
77979Srrh %left ','
87979Srrh %right '='
97979Srrh %right '?' ':'
107979Srrh %left OROR
117979Srrh %left ANDAND
127979Srrh %left '|' '^'
137979Srrh %left '&'
147979Srrh %binary EQ NE
157979Srrh %binary '<' '>' LE GE
167979Srrh %left LS RS
177979Srrh %left '+' '-'
187979Srrh %left '*' '/' '%'
197979Srrh %right '!' '~' UMINUS
207979Srrh %left '(' '.'
217979Srrh %%
227979Srrh S:	e stop	={return($1);}
237979Srrh 
247979Srrh 
257979Srrh e:	  e '*' e
267979Srrh 		={$$ = $1 * $3;}
277979Srrh 	| e '/' e
287979Srrh 		={$$ = $1 / $3;}
297979Srrh 	| e '%' e
307979Srrh 		={$$ = $1 % $3;}
317979Srrh 	| e '+' e
327979Srrh 		={$$ = $1 + $3;}
337979Srrh 	| e '-' e
347979Srrh 		={$$ = $1 - $3;}
357979Srrh 	| e LS e
367979Srrh 		={$$ = $1 << $3;}
377979Srrh 	| e RS e
387979Srrh 		={$$ = $1 >> $3;}
397979Srrh 	| e '<' e
407979Srrh 		={$$ = $1 < $3;}
417979Srrh 	| e '>' e
427979Srrh 		={$$ = $1 > $3;}
437979Srrh 	| e LE e
447979Srrh 		={$$ = $1 <= $3;}
457979Srrh 	| e GE e
467979Srrh 		={$$ = $1 >= $3;}
477979Srrh 	| e EQ e
487979Srrh 		={$$ = $1 == $3;}
497979Srrh 	| e NE e
507979Srrh 		={$$ = $1 != $3;}
517979Srrh 	| e '&' e
527979Srrh 		={$$ = $1 & $3;}
537979Srrh 	| e '^' e
547979Srrh 		={$$ = $1 ^ $3;}
557979Srrh 	| e '|' e
567979Srrh 		={$$ = $1 | $3;}
577979Srrh 	| e ANDAND e
587979Srrh 		={$$ = $1 && $3;}
597979Srrh 	| e OROR e
607979Srrh 		={$$ = $1 || $3;}
617979Srrh 	| e '?' e ':' e
627979Srrh 		={$$ = $1 ? $3 : $5;}
637979Srrh 	| e ',' e
647979Srrh 		={$$ = $3;}
657979Srrh 	| term
667979Srrh 		={$$ = $1;}
677979Srrh term:
687979Srrh 	  '-' term %prec UMINUS
69*10084Ssam 		={$$ = -$2;}
707979Srrh 	| '!' term
717979Srrh 		={$$ = !$2;}
727979Srrh 	| '~' term
737979Srrh 		={$$ = ~$2;}
747979Srrh 	| '(' e ')'
757979Srrh 		={$$ = $2;}
767979Srrh 	| DEFINED '(' number ')'
777979Srrh 		={$$= $3;}
787979Srrh 	| DEFINED number
797979Srrh 		={$$ = $2;}
807979Srrh 	| number
817979Srrh 		={$$= $1;}
827979Srrh %%
837979Srrh # include "yylex.c"
84