|
|
1.1 root 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: { NO66(".EQV. operator");
37: $$ = mkexpr(OPEQV, $1,$3); }
38: | expr SNEQV expr
39: { NO66(".NEQV. operator");
40: $$ = mkexpr(OPNEQV, $1, $3); }
41: | expr SOR expr
42: { $$ = mkexpr(OPOR, $1, $3); }
43: | expr SAND expr
44: { $$ = mkexpr(OPAND, $1, $3); }
45: | SNOT expr
46: { $$ = mkexpr(OPNOT, $2, 0); }
47: | expr SCONCAT expr
48: { NO66("concatenation operator //");
49: $$ = mkexpr(OPCONCAT, $1, $3); }
50: ;
51:
52: addop: SPLUS { $$ = OPPLUS; }
53: | SMINUS { $$ = OPMINUS; }
54: ;
55:
56: relop: SEQ { $$ = OPEQ; }
57: | SGT { $$ = OPGT; }
58: | SLT { $$ = OPLT; }
59: | SGE { $$ = OPGE; }
60: | SLE { $$ = OPLE; }
61: | SNE { $$ = OPNE; }
62: ;
63:
64: lhs: name
65: { $$ = mkprim($1, 0, 0, 0); }
66: | name SLPAR opt_expr SCOLON opt_expr SRPAR
67: { NO66("substring operator :");
68: $$ = mkprim($1, 0, $3, $5); }
69: | name SLPAR funarglist SRPAR
70: { $$ = mkprim($1, mklist($3), 0, 0); }
71: | name SLPAR funarglist SRPAR SLPAR opt_expr SCOLON opt_expr SRPAR
72: { NO66("substring operator :");
73: $$ = mkprim($1, mklist($3), $6, $8); }
74: ;
75:
76: opt_expr:
77: { $$ = 0; }
78: | expr
79: ;
80:
81: simple: name
82: { if($1->vclass == CLPARAM)
83: $$ = cpexpr($1->paramval);
84: }
85: | simple_const
86: ;
87:
88: simple_const: STRUE { $$ = mklogcon(1); }
89: | SFALSE { $$ = mklogcon(0); }
90: | SHOLLERITH { $$ = mkstrcon(toklen, token); }
91: | SICON = { $$ = mkintcon( convci(toklen, token) ); }
92: | SRCON = { $$ = mkrealcon(TYREAL, convcd(toklen, token)); }
93: | SDCON = { $$ = mkrealcon(TYDREAL, convcd(toklen, token)); }
94: ;
95:
96: complex_const: SLPAR uexpr SCOMMA uexpr SRPAR
97: { $$ = mkcxcon($2,$4); }
98: ;
99:
100: bit_const: SHEXCON
101: { NOEXT("hex constant");
102: $$ = mkbitcon(4, toklen, token); }
103: | SOCTCON
104: { NOEXT("octal constant");
105: $$ = mkbitcon(3, toklen, token); }
106: | SBITCON
107: { NOEXT("binary constant");
108: $$ = mkbitcon(1, toklen, token); }
109: ;
110:
111: fexpr: unpar_fexpr
112: | SLPAR fexpr SRPAR
113: { $$ = $2; }
114: ;
115:
116: unpar_fexpr: lhs
117: | simple_const
118: | fexpr addop fexpr %prec SPLUS
119: { $$ = mkexpr($2, $1, $3); }
120: | fexpr SSTAR fexpr
121: { $$ = mkexpr(OPSTAR, $1, $3); }
122: | fexpr SSLASH fexpr
123: { $$ = mkexpr(OPSLASH, $1, $3); }
124: | fexpr SPOWER fexpr
125: { $$ = mkexpr(OPPOWER, $1, $3); }
126: | addop fexpr %prec SSTAR
127: { if($1 == OPMINUS)
128: $$ = mkexpr(OPNEG, $2, 0);
129: else $$ = $2;
130: }
131: | fexpr SCONCAT fexpr
132: { NO66("concatenation operator //");
133: $$ = mkexpr(OPCONCAT, $1, $3); }
134: ;
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.