1 | funarglist:
|
---|
2 | { $$ = 0; }
|
---|
3 | | funargs
|
---|
4 | ;
|
---|
5 |
|
---|
6 | funargs: expr
|
---|
7 | { $$ = mkchain($1, 0); }
|
---|
8 | | funargs SCOMMA expr
|
---|
9 | { $$ = hookup($1, mkchain($3,0) ); }
|
---|
10 | ;
|
---|
11 |
|
---|
12 |
|
---|
13 | expr: uexpr
|
---|
14 | | SLPAR expr SRPAR { $$ = $2; }
|
---|
15 | | complex_const
|
---|
16 | ;
|
---|
17 |
|
---|
18 | uexpr: lhs
|
---|
19 | | simple_const
|
---|
20 | | expr addop expr %prec SPLUS
|
---|
21 | { $$ = mkexpr($2, $1, $3); }
|
---|
22 | | expr SSTAR expr
|
---|
23 | { $$ = mkexpr(OPSTAR, $1, $3); }
|
---|
24 | | expr SSLASH expr
|
---|
25 | { $$ = mkexpr(OPSLASH, $1, $3); }
|
---|
26 | | expr SPOWER expr
|
---|
27 | { $$ = mkexpr(OPPOWER, $1, $3); }
|
---|
28 | | addop expr %prec SSTAR
|
---|
29 | { if($1 == OPMINUS)
|
---|
30 | $$ = mkexpr(OPNEG, $2, 0);
|
---|
31 | else $$ = $2;
|
---|
32 | }
|
---|
33 | | expr relop expr %prec SEQ
|
---|
34 | { $$ = mkexpr($2, $1, $3); }
|
---|
35 | | expr SEQV expr
|
---|
36 | { $$ = mkexpr(OPEQV, $1,$3); }
|
---|
37 | | expr SNEQV expr
|
---|
38 | { $$ = mkexpr(OPNEQV, $1, $3); }
|
---|
39 | | expr SOR expr
|
---|
40 | { $$ = mkexpr(OPOR, $1, $3); }
|
---|
41 | | expr SAND expr
|
---|
42 | { $$ = mkexpr(OPAND, $1, $3); }
|
---|
43 | | SNOT expr
|
---|
44 | { $$ = mkexpr(OPNOT, $2, 0); }
|
---|
45 | | expr SCONCAT expr
|
---|
46 | { $$ = mkexpr(OPCONCAT, $1, $3); }
|
---|
47 | ;
|
---|
48 |
|
---|
49 | addop: SPLUS { $$ = OPPLUS; }
|
---|
50 | | SMINUS { $$ = OPMINUS; }
|
---|
51 | ;
|
---|
52 |
|
---|
53 | relop: SEQ { $$ = OPEQ; }
|
---|
54 | | SGT { $$ = OPGT; }
|
---|
55 | | SLT { $$ = OPLT; }
|
---|
56 | | SGE { $$ = OPGE; }
|
---|
57 | | SLE { $$ = OPLE; }
|
---|
58 | | SNE { $$ = OPNE; }
|
---|
59 | ;
|
---|
60 |
|
---|
61 | lhs: name
|
---|
62 | { $$ = mkprim($1, 0, 0, 0); }
|
---|
63 | | name SLPAR opt_expr SCOLON opt_expr SRPAR
|
---|
64 | { $$ = mkprim($1, 0, $3, $5); }
|
---|
65 | | name SLPAR funarglist SRPAR
|
---|
66 | { $$ = mkprim($1, mklist($3), 0, 0); }
|
---|
67 | | name SLPAR funarglist SRPAR SLPAR opt_expr SCOLON opt_expr SRPAR
|
---|
68 | { $$ = mkprim($1, mklist($3), $6, $8); }
|
---|
69 | ;
|
---|
70 |
|
---|
71 | opt_expr:
|
---|
72 | { $$ = 0; }
|
---|
73 | | expr
|
---|
74 | ;
|
---|
75 |
|
---|
76 | simple: name
|
---|
77 | { if($1->vclass == CLPARAM)
|
---|
78 | $$ = cpexpr($1->b_param.paramval);
|
---|
79 | }
|
---|
80 | | simple_const
|
---|
81 | ;
|
---|
82 |
|
---|
83 | simple_const: STRUE { $$ = mklogcon(1); }
|
---|
84 | | SFALSE { $$ = mklogcon(0); }
|
---|
85 | | SHOLLERITH { $$ = mkstrcon(toklen, token); }
|
---|
86 | | SICON { $$ = mkintcon( convci(toklen, token) ); }
|
---|
87 | | SRCON { $$ = mkrealcon(TYREAL, convcd(toklen, token)); }
|
---|
88 | | SDCON { $$ = mkrealcon(TYDREAL, convcd(toklen, token)); }
|
---|
89 | ;
|
---|
90 |
|
---|
91 | complex_const: SLPAR uexpr SCOMMA uexpr SRPAR
|
---|
92 | { $$ = mkcxcon($2,$4); }
|
---|
93 | ;
|
---|
94 |
|
---|
95 | bit_const: SHEXCON
|
---|
96 | { $$ = mkbitcon(4, toklen, token); }
|
---|
97 | | SOCTCON
|
---|
98 | { $$ = mkbitcon(3, toklen, token); }
|
---|
99 | | SBITCON
|
---|
100 | { $$ = mkbitcon(1, toklen, token); }
|
---|
101 | ;
|
---|
102 |
|
---|
103 | fexpr: unpar_fexpr
|
---|
104 | | SLPAR fexpr SRPAR
|
---|
105 | { $$ = $2; }
|
---|
106 | ;
|
---|
107 |
|
---|
108 | unpar_fexpr: lhs
|
---|
109 | | simple_const
|
---|
110 | | fexpr addop fexpr %prec SPLUS
|
---|
111 | { $$ = mkexpr($2, $1, $3); }
|
---|
112 | | fexpr SSTAR fexpr
|
---|
113 | { $$ = mkexpr(OPSTAR, $1, $3); }
|
---|
114 | | fexpr SSLASH fexpr
|
---|
115 | { $$ = mkexpr(OPSLASH, $1, $3); }
|
---|
116 | | fexpr SPOWER fexpr
|
---|
117 | { $$ = mkexpr(OPPOWER, $1, $3); }
|
---|
118 | | addop fexpr %prec SSTAR
|
---|
119 | { if($1 == OPMINUS)
|
---|
120 | $$ = mkexpr(OPNEG, $2, 0);
|
---|
121 | else $$ = $2;
|
---|
122 | }
|
---|
123 | | fexpr SCONCAT fexpr
|
---|
124 | { $$ = mkexpr(OPCONCAT, $1, $3); }
|
---|
125 | ;
|
---|