date and time created 82/08/30 09:57:35 by rrh
authorRobert R. Henry <rrh@ucbvax.Berkeley.EDU>
Tue, 31 Aug 1982 00:57:35 +0000 (16:57 -0800)
committerRobert R. Henry <rrh@ucbvax.Berkeley.EDU>
Tue, 31 Aug 1982 00:57:35 +0000 (16:57 -0800)
SCCS-vsn: old/cpp/cpy.y 1.1

usr/src/old/cpp/cpy.y [new file with mode: 0644]

diff --git a/usr/src/old/cpp/cpy.y b/usr/src/old/cpp/cpy.y
new file mode 100644 (file)
index 0000000..f2fec68
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * @(#)cpy.y 1.1 %G%
+ */
+%term number stop DEFINED
+%term EQ NE LE GE LS RS
+%term ANDAND OROR
+%left ','
+%right '='
+%right '?' ':'
+%left OROR
+%left ANDAND
+%left '|' '^'
+%left '&'
+%binary EQ NE
+%binary '<' '>' LE GE
+%left LS RS
+%left '+' '-'
+%left '*' '/' '%'
+%right '!' '~' UMINUS
+%left '(' '.'
+%%
+S:     e stop  ={return($1);}
+
+
+e:       e '*' e
+               ={$$ = $1 * $3;}
+       | e '/' e
+               ={$$ = $1 / $3;}
+       | e '%' e
+               ={$$ = $1 % $3;}
+       | e '+' e
+               ={$$ = $1 + $3;}
+       | e '-' e
+               ={$$ = $1 - $3;}
+       | e LS e
+               ={$$ = $1 << $3;}
+       | e RS e
+               ={$$ = $1 >> $3;}
+       | e '<' e
+               ={$$ = $1 < $3;}
+       | e '>' e
+               ={$$ = $1 > $3;}
+       | e LE e
+               ={$$ = $1 <= $3;}
+       | e GE e
+               ={$$ = $1 >= $3;}
+       | e EQ e
+               ={$$ = $1 == $3;}
+       | e NE e
+               ={$$ = $1 != $3;}
+       | e '&' e
+               ={$$ = $1 & $3;}
+       | e '^' e
+               ={$$ = $1 ^ $3;}
+       | e '|' e
+               ={$$ = $1 | $3;}
+       | e ANDAND e
+               ={$$ = $1 && $3;}
+       | e OROR e
+               ={$$ = $1 || $3;}
+       | e '?' e ':' e
+               ={$$ = $1 ? $3 : $5;}
+       | e ',' e
+               ={$$ = $3;}
+       | term
+               ={$$ = $1;}
+term:
+         '-' term %prec UMINUS
+               ={$$ = -$1;}
+       | '!' term
+               ={$$ = !$2;}
+       | '~' term
+               ={$$ = ~$2;}
+       | '(' e ')'
+               ={$$ = $2;}
+       | DEFINED '(' number ')'
+               ={$$= $3;}
+       | DEFINED number
+               ={$$ = $2;}
+       | number
+               ={$$= $1;}
+%%
+# include "yylex.c"