|
|
1.1 root 1: /*
2: * @(#)cpy.y 1.2 1/2/83
3: */
4: %term number stop DEFINED
5: %term EQ NE LE GE LS RS
6: %term ANDAND OROR
7: %left ','
8: %right '='
9: %right '?' ':'
10: %left OROR
11: %left ANDAND
12: %left '|' '^'
13: %left '&'
14: %binary EQ NE
15: %binary '<' '>' LE GE
16: %left LS RS
17: %left '+' '-'
18: %left '*' '/' '%'
19: %right '!' '~' UMINUS
20: %left '(' '.'
21: %%
22: S: e stop ={return($1);}
23:
24:
25: e: 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 '-' e
34: ={$$ = $1 - $3;}
35: | e LS e
36: ={$$ = $1 << $3;}
37: | e RS e
38: ={$$ = $1 >> $3;}
39: | e '<' e
40: ={$$ = $1 < $3;}
41: | e '>' e
42: ={$$ = $1 > $3;}
43: | e LE e
44: ={$$ = $1 <= $3;}
45: | e GE e
46: ={$$ = $1 >= $3;}
47: | e EQ e
48: ={$$ = $1 == $3;}
49: | e NE e
50: ={$$ = $1 != $3;}
51: | e '&' e
52: ={$$ = $1 & $3;}
53: | e '^' e
54: ={$$ = $1 ^ $3;}
55: | e '|' e
56: ={$$ = $1 | $3;}
57: | e ANDAND e
58: ={$$ = $1 && $3;}
59: | e OROR e
60: ={$$ = $1 || $3;}
61: | e '?' e ':' e
62: ={$$ = $1 ? $3 : $5;}
63: | e ',' e
64: ={$$ = $3;}
65: | term
66: ={$$ = $1;}
67: term:
68: '-' term %prec UMINUS
69: ={$$ = -$2;}
70: | '!' term
71: ={$$ = !$2;}
72: | '~' term
73: ={$$ = ~$2;}
74: | '(' e ')'
75: ={$$ = $2;}
76: | DEFINED '(' number ')'
77: ={$$= $3;}
78: | DEFINED number
79: ={$$ = $2;}
80: | number
81: ={$$= $1;}
82: %%
83: # include "yylex.c"
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.