|
|
1.1 root 1: funarglist:
2: { $$ = 0; }
3: | funargs
4: { $$ = revchain($1); }
5: ;
6:
7: funargs: expr
8: { $$ = mkchain((char *)$1, CHNULL); }
9: | funargs SCOMMA expr
10: { $$ = mkchain((char *)$3, $1); }
11: ;
12:
13:
14: expr: uexpr
15: | SLPAR expr SRPAR { $$ = $2; if ($$->tag == TPRIM)
16: $$->primblock.parenused = 1; }
17: | complex_const
18: ;
19:
20: uexpr: lhs
21: | simple_const
22: | expr addop expr %prec SPLUS
23: { $$ = mkexpr($2, $1, $3); }
24: | expr SSTAR expr
25: { $$ = mkexpr(OPSTAR, $1, $3); }
26: | expr SSLASH expr
27: { $$ = mkexpr(OPSLASH, $1, $3); }
28: | expr SPOWER expr
29: { $$ = mkexpr(OPPOWER, $1, $3); }
30: | addop expr %prec SSTAR
31: { if($1 == OPMINUS)
32: $$ = mkexpr(OPNEG, $2, ENULL);
33: else $$ = $2;
34: }
35: | expr relop expr %prec SEQ
36: { $$ = mkexpr($2, $1, $3); }
37: | expr SEQV expr
38: { NO66(".EQV. operator");
39: $$ = mkexpr(OPEQV, $1,$3); }
40: | expr SNEQV expr
41: { NO66(".NEQV. operator");
42: $$ = mkexpr(OPNEQV, $1, $3); }
43: | expr SOR expr
44: { $$ = mkexpr(OPOR, $1, $3); }
45: | expr SAND expr
46: { $$ = mkexpr(OPAND, $1, $3); }
47: | SNOT expr
48: { $$ = mkexpr(OPNOT, $2, ENULL); }
49: | expr SCONCAT expr
50: { NO66("concatenation operator //");
51: $$ = mkexpr(OPCONCAT, $1, $3); }
52: ;
53:
54: addop: SPLUS { $$ = OPPLUS; }
55: | SMINUS { $$ = OPMINUS; }
56: ;
57:
58: relop: SEQ { $$ = OPEQ; }
59: | SGT { $$ = OPGT; }
60: | SLT { $$ = OPLT; }
61: | SGE { $$ = OPGE; }
62: | SLE { $$ = OPLE; }
63: | SNE { $$ = OPNE; }
64: ;
65:
66: lhs: name
67: { $$ = mkprim($1, LBNULL, CHNULL); }
68: | name substring
69: { NO66("substring operator :");
70: $$ = mkprim($1, LBNULL, $2); }
71: | name SLPAR funarglist SRPAR
72: { $$ = mkprim($1, mklist($3), CHNULL); }
73: | name SLPAR funarglist SRPAR substring
74: { NO66("substring operator :");
75: $$ = mkprim($1, mklist($3), $5); }
76: ;
77:
78: substring: SLPAR opt_expr SCOLON opt_expr SRPAR
79: { $$ = mkchain((char *)$2, mkchain((char *)$4,CHNULL)); }
80: ;
81:
82: opt_expr:
83: { $$ = 0; }
84: | expr
85: ;
86:
87: simple: name
88: { if($1->vclass == CLPARAM)
89: $$ = (expptr) cpexpr(
90: ( (struct Paramblock *) ($1) ) -> paramval);
91: }
92: | simple_const
93: ;
94:
95: simple_const: STRUE { $$ = mklogcon(1); }
96: | SFALSE { $$ = mklogcon(0); }
97: | SHOLLERITH { $$ = mkstrcon(toklen, token); }
98: | SICON = { $$ = mkintcon( convci(toklen, token) ); }
99: | SRCON = { $$ = mkrealcon(tyreal, token); }
100: | SDCON = { $$ = mkrealcon(TYDREAL, token); }
101: | bit_const
102: ;
103:
104: complex_const: SLPAR uexpr SCOMMA uexpr SRPAR
105: { $$ = mkcxcon($2,$4); }
106: ;
107:
108: bit_const: SHEXCON
109: { NOEXT("hex constant");
110: $$ = mkbitcon(4, toklen, token); }
111: | SOCTCON
112: { NOEXT("octal constant");
113: $$ = mkbitcon(3, toklen, token); }
114: | SBITCON
115: { NOEXT("binary constant");
116: $$ = mkbitcon(1, toklen, token); }
117: ;
118:
119: fexpr: unpar_fexpr
120: | SLPAR fexpr SRPAR
121: { $$ = $2; }
122: ;
123:
124: unpar_fexpr: lhs
125: | simple_const
126: | fexpr addop fexpr %prec SPLUS
127: { $$ = mkexpr($2, $1, $3); }
128: | fexpr SSTAR fexpr
129: { $$ = mkexpr(OPSTAR, $1, $3); }
130: | fexpr SSLASH fexpr
131: { $$ = mkexpr(OPSLASH, $1, $3); }
132: | fexpr SPOWER fexpr
133: { $$ = mkexpr(OPPOWER, $1, $3); }
134: | addop fexpr %prec SSTAR
135: { if($1 == OPMINUS)
136: $$ = mkexpr(OPNEG, $2, ENULL);
137: else $$ = $2;
138: }
139: | fexpr SCONCAT fexpr
140: { NO66("concatenation operator //");
141: $$ = mkexpr(OPCONCAT, $1, $3); }
142: ;
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.