1 rizwank 1.1
2 /* A Bison parser, made from gram.y
3 by GNU Bison version 1.28 */
4
5 #define YYBISON 1 /* Identify Bison output. */
6
7 #define tSYMBOL 257
8 #define tREGEXP 258
9 #define tSTRING 259
10 #define tINTEGER 260
11 #define tREAL 261
12 #define tSUB 262
13 #define tSTATE 263
14 #define tSTART 264
15 #define tSTARTRULES 265
16 #define tNAMERULES 266
17 #define tBEGIN 267
18 #define tEND 268
19 #define tRETURN 269
20 #define tIF 270
21 #define tELSE 271
22 rizwank 1.1 #define tLOCAL 272
23 #define tWHILE 273
24 #define tFOR 274
25 #define tEXTENDS 275
26 #define tADDASSIGN 276
27 #define tSUBASSIGN 277
28 #define tMULASSIGN 278
29 #define tDIVASSIGN 279
30 #define tOR 280
31 #define tAND 281
32 #define tEQ 282
33 #define tNE 283
34 #define tGE 284
35 #define tLE 285
36 #define tDIV 286
37 #define tPLUSPLUS 287
38 #define tMINUSMINUS 288
39
40 #line 1 "gram.y"
41
42 /* -*- c -*-
43 rizwank 1.1 * Grammar for states.
44 * Copyright (c) 1997-1998 Markku Rossi.
45 *
46 * Author: Markku Rossi <mtr@iki.fi>
47 */
48
49 /*
50 * This file is part of GNU enscript.
51 *
52 * This program is free software; you can redistribute it and/or modify
53 * it under the terms of the GNU General Public License as published by
54 * the Free Software Foundation; either version 2, or (at your option)
55 * any later version.
56 *
57 * This program is distributed in the hope that it will be useful,
58 * but WITHOUT ANY WARRANTY; without even the implied warranty of
59 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
60 * GNU General Public License for more details.
61 *
62 * You should have received a copy of the GNU General Public License
63 * along with this program; see the file COPYING. If not, write to
64 rizwank 1.1 * the Free Software Foundation, 59 Temple Place - Suite 330,
65 * Boston, MA 02111-1307, USA.
66 */
67
68 /*
69 * $Id: gram.y,v 1.9 1998/10/21 08:45:22 mtr Exp $
70 */
71
72 #include "defs.h"
73
74 #line 35 "gram.y"
75 typedef union
76 {
77 List *lst;
78 Node *node;
79 Cons *cons;
80 Stmt *stmt;
81 Expr *expr;
82 } YYSTYPE;
83 #include <stdio.h>
84
85 rizwank 1.1 #ifndef __cplusplus
86 #ifndef __STDC__
87 #define const
88 #endif
89 #endif
90
91
92
93 #define YYFINAL 167
94 #define YYFLAG -32768
95 #define YYNTBASE 52
96
97 #define YYTRANSLATE(x) ((unsigned)(x) <= 288 ? yytranslate[x] : 68)
98
99 static const char yytranslate[] = { 0,
100 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
101 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
102 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
103 2, 2, 41, 2, 2, 2, 2, 2, 2, 50,
104 51, 39, 37, 49, 38, 2, 2, 2, 2, 2,
105 2, 2, 2, 2, 2, 2, 2, 28, 48, 33,
106 rizwank 1.1 22, 34, 27, 2, 2, 2, 2, 2, 2, 2,
107 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
108 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
109 44, 2, 45, 2, 2, 2, 2, 2, 2, 2,
110 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
111 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
112 2, 2, 46, 2, 47, 2, 2, 2, 2, 2,
113 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
114 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
115 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
116 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
117 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
118 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
119 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
120 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
121 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
122 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
123 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
124 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
125 2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
126 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
127 rizwank 1.1 17, 18, 19, 20, 21, 23, 24, 25, 26, 29,
128 30, 31, 32, 35, 36, 40, 42, 43
129 };
130
131 #if YYDEBUG != 0
132 static const short yyprhs[] = { 0,
133 0, 1, 4, 9, 14, 19, 25, 33, 35, 36,
134 41, 42, 45, 50, 55, 60, 65, 66, 68, 70,
135 74, 75, 79, 81, 85, 87, 91, 92, 95, 98,
136 102, 112, 116, 122, 130, 136, 146, 149, 151, 153,
137 155, 157, 159, 162, 166, 170, 175, 179, 183, 187,
138 191, 195, 198, 201, 204, 207, 214, 218, 223, 229,
139 233, 237, 241, 245, 249, 253, 257, 261, 265, 269,
140 270, 272, 273, 275, 277
141 };
142
143 static const short yyrhs[] = { -1,
144 52, 53, 0, 10, 46, 62, 47, 0, 11, 46,
145 54, 47, 0, 12, 46, 54, 47, 0, 9, 3,
146 46, 55, 47, 0, 9, 3, 21, 3, 46, 55,
147 47, 0, 63, 0, 0, 54, 4, 3, 48, 0,
148 rizwank 1.1 0, 55, 56, 0, 13, 46, 62, 47, 0, 14,
149 46, 62, 47, 0, 4, 46, 62, 47, 0, 3,
150 46, 62, 47, 0, 0, 58, 0, 3, 0, 58,
151 49, 3, 0, 0, 18, 60, 48, 0, 61, 0,
152 60, 49, 61, 0, 3, 0, 3, 22, 64, 0,
153 0, 62, 63, 0, 15, 48, 0, 15, 64, 48,
154 0, 8, 3, 50, 57, 51, 46, 59, 62, 47,
155 0, 46, 62, 47, 0, 16, 50, 64, 51, 63,
156 0, 16, 50, 64, 51, 63, 17, 63, 0, 19,
157 50, 64, 51, 63, 0, 20, 50, 65, 48, 64,
158 48, 65, 51, 63, 0, 64, 48, 0, 5, 0,
159 4, 0, 6, 0, 7, 0, 3, 0, 41, 64,
160 0, 64, 30, 64, 0, 64, 29, 64, 0, 3,
161 50, 66, 51, 0, 3, 22, 64, 0, 3, 23,
162 64, 0, 3, 24, 64, 0, 3, 25, 64, 0,
163 3, 26, 64, 0, 3, 42, 0, 3, 43, 0,
164 42, 3, 0, 43, 3, 0, 64, 44, 64, 45,
165 22, 64, 0, 50, 64, 51, 0, 64, 44, 64,
166 45, 0, 64, 27, 64, 28, 64, 0, 64, 39,
167 64, 0, 64, 40, 64, 0, 64, 37, 64, 0,
168 64, 38, 64, 0, 64, 33, 64, 0, 64, 34,
169 rizwank 1.1 64, 0, 64, 31, 64, 0, 64, 32, 64, 0,
170 64, 35, 64, 0, 64, 36, 64, 0, 0, 64,
171 0, 0, 67, 0, 64, 0, 67, 49, 64, 0
172 };
173
174 #endif
175
176 #if YYDEBUG != 0
177 static const short yyrline[] = { 0,
178 67, 68, 71, 72, 74, 76, 78, 80, 83, 84,
179 88, 89, 91, 92, 93, 94, 97, 98, 101, 102,
180 105, 106, 109, 110, 113, 114, 117, 118, 121, 123,
181 125, 130, 132, 134, 137, 139, 142, 146, 148, 150,
182 152, 154, 156, 158, 159, 160, 162, 164, 166, 168,
183 170, 172, 174, 176, 178, 180, 182, 183, 185, 187,
184 188, 189, 190, 192, 193, 194, 195, 196, 197, 200,
185 201, 204, 205, 208, 209
186 };
187 #endif
188
189
190 rizwank 1.1 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
191
192 static const char * const yytname[] = { "$","error","$undefined.","tSYMBOL",
193 "tREGEXP","tSTRING","tINTEGER","tREAL","tSUB","tSTATE","tSTART","tSTARTRULES",
194 "tNAMERULES","tBEGIN","tEND","tRETURN","tIF","tELSE","tLOCAL","tWHILE","tFOR",
195 "tEXTENDS","'='","tADDASSIGN","tSUBASSIGN","tMULASSIGN","tDIVASSIGN","'?'","':'",
196 "tOR","tAND","tEQ","tNE","'<'","'>'","tGE","tLE","'+'","'-'","'*'","tDIV","'!'",
197 "tPLUSPLUS","tMINUSMINUS","'['","']'","'{'","'}'","';'","','","'('","')'","file",
198 "toplevel","regexp_sym_list","staterules","staterule","symbol_list","rest_symbol_list",
199 "locals","locals_rest","local_def","stmt_list","stmt","expr","cond_expr","expr_list",
200 "rest_expr_list", NULL
201 };
202 #endif
203
204 static const short yyr1[] = { 0,
205 52, 52, 53, 53, 53, 53, 53, 53, 54, 54,
206 55, 55, 56, 56, 56, 56, 57, 57, 58, 58,
207 59, 59, 60, 60, 61, 61, 62, 62, 63, 63,
208 63, 63, 63, 63, 63, 63, 63, 64, 64, 64,
209 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
210 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
211 rizwank 1.1 64, 64, 64, 64, 64, 64, 64, 64, 64, 65,
212 65, 66, 66, 67, 67
213 };
214
215 static const short yyr2[] = { 0,
216 0, 2, 4, 4, 4, 5, 7, 1, 0, 4,
217 0, 2, 4, 4, 4, 4, 0, 1, 1, 3,
218 0, 3, 1, 3, 1, 3, 0, 2, 2, 3,
219 9, 3, 5, 7, 5, 9, 2, 1, 1, 1,
220 1, 1, 2, 3, 3, 4, 3, 3, 3, 3,
221 3, 2, 2, 2, 2, 6, 3, 4, 5, 3,
222 3, 3, 3, 3, 3, 3, 3, 3, 3, 0,
223 1, 0, 1, 1, 3
224 };
225
226 static const short yydefact[] = { 1,
227 0, 42, 39, 38, 40, 41, 0, 0, 0, 0,
228 0, 0, 0, 0, 0, 0, 0, 0, 27, 0,
229 2, 8, 0, 0, 0, 0, 0, 0, 52, 53,
230 72, 0, 0, 27, 9, 9, 29, 0, 0, 0,
231 70, 43, 54, 55, 0, 0, 0, 0, 0, 0,
232 rizwank 1.1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
233 37, 47, 48, 49, 50, 51, 74, 0, 73, 17,
234 0, 11, 0, 0, 0, 30, 0, 0, 71, 0,
235 32, 28, 57, 0, 45, 44, 66, 67, 64, 65,
236 68, 69, 62, 63, 60, 61, 0, 46, 0, 19,
237 0, 18, 0, 0, 3, 0, 4, 5, 0, 0,
238 0, 0, 58, 75, 0, 0, 11, 0, 0, 0,
239 0, 6, 12, 0, 33, 35, 0, 59, 0, 21,
240 20, 0, 27, 27, 27, 27, 10, 0, 70, 56,
241 0, 27, 7, 0, 0, 0, 0, 34, 0, 25,
242 0, 23, 0, 16, 15, 13, 14, 0, 0, 22,
243 0, 31, 36, 26, 24, 0, 0
244 };
245
246 static const short yydefgoto[] = { 1,
247 21, 74, 104, 123, 101, 102, 142, 151, 152, 45,
248 82, 23, 80, 68, 69
249 };
250
251 static const short yypact[] = {-32768,
252 71, 270,-32768,-32768,-32768,-32768, 1, 9, -40, -28,
253 rizwank 1.1 -27, 18, -24, -18, -17, 90, 28, 31,-32768, 90,
254 -32768,-32768, 374, 90, 90, 90, 90, 90,-32768,-32768,
255 90, -15, -19,-32768,-32768,-32768,-32768, 394, 90, 90,
256 90, 12,-32768,-32768, 119, 305, 90, 90, 90, 90,
257 90, 90, 90, 90, 90, 90, 90, 90, 90, 90,
258 -32768, 469, 469, 469, 469, 469, 469, 7, 20, 64,
259 67,-32768, 139, 3, 4,-32768, 328, 351, 469, 36,
260 -32768,-32768,-32768, 453, 484, 498, 510, 510, 112, 112,
261 112, 112, 13, 13, 12, 12, 434,-32768, 90,-32768,
262 34, 40, 46, 51,-32768, 96,-32768,-32768, 283, 283,
263 90, 90, 85, 469, 69, 107,-32768, 70, 73, 74,
264 83,-32768,-32768, 82, 124,-32768, 414, 469, 90, 118,
265 -32768, 59,-32768,-32768,-32768,-32768,-32768, 283, 90, 469,
266 150,-32768,-32768, 168, 187, 216, 235,-32768, 113, 141,
267 -38,-32768, 264,-32768,-32768,-32768,-32768, 283, 90,-32768,
268 150,-32768,-32768, 469,-32768, 167,-32768
269 };
270
271 static const short yypgoto[] = {-32768,
272 -32768, 132, 53,-32768,-32768,-32768,-32768,-32768, 16, -31,
273 -1, -11, 39,-32768,-32768
274 rizwank 1.1 };
275
276
277 #define YYLAST 554
278
279
280 static const short yytable[] = { 22,
281 38, 71, 73, 32, 42, 34, 106, 106, 46, 160,
282 161, 33, 62, 63, 64, 65, 66, 35, 36, 67,
283 2, 3, 4, 5, 6, 39, 72, 77, 78, 79,
284 43, 40, 41, 44, 70, 84, 85, 86, 87, 88,
285 89, 90, 91, 92, 93, 94, 95, 96, 97, 107,
286 108, 58, 59, 118, 119, 60, 60, 98, 16, 17,
287 18, 118, 119, 120, 121, 37, 100, 20, 99, 103,
288 166, 120, 121, 2, 3, 4, 5, 6, 7, 8,
289 9, 10, 11, 111, 115, 12, 13, 114, 116, 14,
290 15, 117, 2, 3, 4, 5, 6, 122, 124, 127,
291 128, 144, 145, 146, 147, 143, 129, 125, 126, 131,
292 153, 16, 17, 18, 130, 133, 19, 140, 134, 135,
293 20, 2, 3, 4, 5, 6, 7, 79, 136, 137,
294 16, 17, 18, 12, 13, 141, 148, 14, 15, 20,
295 rizwank 1.1 138, 2, 3, 4, 5, 6, 7, 164, 56, 57,
296 58, 59, 150, 12, 13, 60, 163, 14, 15, 16,
297 17, 18, 159, 158, 19, 81, 167, 75, 20, 132,
298 2, 3, 4, 5, 6, 7, 165, 149, 0, 16,
299 17, 18, 12, 13, 19, 105, 14, 15, 20, 2,
300 3, 4, 5, 6, 7, 0, 0, 0, 0, 0,
301 0, 12, 13, 0, 0, 14, 15, 0, 16, 17,
302 18, 0, 0, 19, 154, 0, 0, 20, 2, 3,
303 4, 5, 6, 7, 0, 0, 0, 16, 17, 18,
304 12, 13, 19, 155, 14, 15, 20, 2, 3, 4,
305 5, 6, 7, 0, 0, 0, 0, 0, 0, 12,
306 13, 0, 0, 14, 15, 0, 16, 17, 18, 0,
307 0, 19, 156, 0, 0, 20, 2, 3, 4, 5,
308 6, 7, 0, 0, 0, 16, 17, 18, 12, 13,
309 19, 157, 14, 15, 20, 2, 3, 4, 5, 6,
310 7, 24, 25, 26, 27, 28, 0, 12, 13, 0,
311 0, 14, 15, 0, 16, 17, 18, 0, 0, 19,
312 162, 29, 30, 20, 0, 0, 0, 0, 0, 31,
313 0, 0, 0, 16, 17, 18, 0, 0, 19, 0,
314 0, 47, 20, 48, 49, 50, 51, 52, 53, 54,
315 55, 56, 57, 58, 59, 0, 0, 0, 60, 0,
316 rizwank 1.1 0, 0, 0, 0, 47, 83, 48, 49, 50, 51,
317 52, 53, 54, 55, 56, 57, 58, 59, 0, 0,
318 0, 60, 0, 0, 0, 0, 0, 47, 109, 48,
319 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
320 59, 0, 0, 0, 60, 0, 0, 0, 0, 0,
321 47, 110, 48, 49, 50, 51, 52, 53, 54, 55,
322 56, 57, 58, 59, 0, 0, 0, 60, 0, 0,
323 47, 61, 48, 49, 50, 51, 52, 53, 54, 55,
324 56, 57, 58, 59, 0, 0, 0, 60, 0, 0,
325 47, 76, 48, 49, 50, 51, 52, 53, 54, 55,
326 56, 57, 58, 59, 0, 0, 0, 60, 0, 0,
327 47, 139, 48, 49, 50, 51, 52, 53, 54, 55,
328 56, 57, 58, 59, 0, 0, 0, 60, 113, 47,
329 112, 48, 49, 50, 51, 52, 53, 54, 55, 56,
330 57, 58, 59, 0, 0, 47, 60, 48, 49, 50,
331 51, 52, 53, 54, 55, 56, 57, 58, 59, 0,
332 0, 0, 60, 49, 50, 51, 52, 53, 54, 55,
333 56, 57, 58, 59, 0, 0, 0, 60, 50, 51,
334 52, 53, 54, 55, 56, 57, 58, 59, 0, 0,
335 0, 60, 52, 53, 54, 55, 56, 57, 58, 59,
336 0, 0, 0, 60
337 rizwank 1.1 };
338
339 static const short yycheck[] = { 1,
340 12, 21, 34, 3, 16, 46, 4, 4, 20, 48,
341 49, 3, 24, 25, 26, 27, 28, 46, 46, 31,
342 3, 4, 5, 6, 7, 50, 46, 39, 40, 41,
343 3, 50, 50, 3, 50, 47, 48, 49, 50, 51,
344 52, 53, 54, 55, 56, 57, 58, 59, 60, 47,
345 47, 39, 40, 3, 4, 44, 44, 51, 41, 42,
346 43, 3, 4, 13, 14, 48, 3, 50, 49, 3,
347 0, 13, 14, 3, 4, 5, 6, 7, 8, 9,
348 10, 11, 12, 48, 51, 15, 16, 99, 49, 19,
349 20, 46, 3, 4, 5, 6, 7, 47, 3, 111,
350 112, 133, 134, 135, 136, 47, 22, 109, 110, 3,
351 142, 41, 42, 43, 46, 46, 46, 129, 46, 46,
352 50, 3, 4, 5, 6, 7, 8, 139, 46, 48,
353 41, 42, 43, 15, 16, 18, 138, 19, 20, 50,
354 17, 3, 4, 5, 6, 7, 8, 159, 37, 38,
355 39, 40, 3, 15, 16, 44, 158, 19, 20, 41,
356 42, 43, 22, 51, 46, 47, 0, 36, 50, 117,
357 3, 4, 5, 6, 7, 8, 161, 139, -1, 41,
358 rizwank 1.1 42, 43, 15, 16, 46, 47, 19, 20, 50, 3,
359 4, 5, 6, 7, 8, -1, -1, -1, -1, -1,
360 -1, 15, 16, -1, -1, 19, 20, -1, 41, 42,
361 43, -1, -1, 46, 47, -1, -1, 50, 3, 4,
362 5, 6, 7, 8, -1, -1, -1, 41, 42, 43,
363 15, 16, 46, 47, 19, 20, 50, 3, 4, 5,
364 6, 7, 8, -1, -1, -1, -1, -1, -1, 15,
365 16, -1, -1, 19, 20, -1, 41, 42, 43, -1,
366 -1, 46, 47, -1, -1, 50, 3, 4, 5, 6,
367 7, 8, -1, -1, -1, 41, 42, 43, 15, 16,
368 46, 47, 19, 20, 50, 3, 4, 5, 6, 7,
369 8, 22, 23, 24, 25, 26, -1, 15, 16, -1,
370 -1, 19, 20, -1, 41, 42, 43, -1, -1, 46,
371 47, 42, 43, 50, -1, -1, -1, -1, -1, 50,
372 -1, -1, -1, 41, 42, 43, -1, -1, 46, -1,
373 -1, 27, 50, 29, 30, 31, 32, 33, 34, 35,
374 36, 37, 38, 39, 40, -1, -1, -1, 44, -1,
375 -1, -1, -1, -1, 27, 51, 29, 30, 31, 32,
376 33, 34, 35, 36, 37, 38, 39, 40, -1, -1,
377 -1, 44, -1, -1, -1, -1, -1, 27, 51, 29,
378 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
379 rizwank 1.1 40, -1, -1, -1, 44, -1, -1, -1, -1, -1,
380 27, 51, 29, 30, 31, 32, 33, 34, 35, 36,
381 37, 38, 39, 40, -1, -1, -1, 44, -1, -1,
382 27, 48, 29, 30, 31, 32, 33, 34, 35, 36,
383 37, 38, 39, 40, -1, -1, -1, 44, -1, -1,
384 27, 48, 29, 30, 31, 32, 33, 34, 35, 36,
385 37, 38, 39, 40, -1, -1, -1, 44, -1, -1,
386 27, 48, 29, 30, 31, 32, 33, 34, 35, 36,
387 37, 38, 39, 40, -1, -1, -1, 44, 45, 27,
388 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
389 38, 39, 40, -1, -1, 27, 44, 29, 30, 31,
390 32, 33, 34, 35, 36, 37, 38, 39, 40, -1,
391 -1, -1, 44, 30, 31, 32, 33, 34, 35, 36,
392 37, 38, 39, 40, -1, -1, -1, 44, 31, 32,
393 33, 34, 35, 36, 37, 38, 39, 40, -1, -1,
394 -1, 44, 33, 34, 35, 36, 37, 38, 39, 40,
395 -1, -1, -1, 44
396 };
397 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
398 #line 3 "/l/mtr/gnu/share/bison.simple"
399 /* This file comes from bison-1.28. */
400 rizwank 1.1
401 /* Skeleton output parser for bison,
402 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
403
404 This program is free software; you can redistribute it and/or modify
405 it under the terms of the GNU General Public License as published by
406 the Free Software Foundation; either version 2, or (at your option)
407 any later version.
408
409 This program is distributed in the hope that it will be useful,
410 but WITHOUT ANY WARRANTY; without even the implied warranty of
411 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
412 GNU General Public License for more details.
413
414 You should have received a copy of the GNU General Public License
415 along with this program; if not, write to the Free Software
416 Foundation, Inc., 59 Temple Place - Suite 330,
417 Boston, MA 02111-1307, USA. */
418
419 /* As a special exception, when this file is copied by Bison into a
420 Bison output file, you may use that output file without restriction.
421 rizwank 1.1 This special exception was added by the Free Software Foundation
422 in version 1.24 of Bison. */
423
424 /* This is the parser code that is written into each bison parser
425 when the %semantic_parser declaration is not specified in the grammar.
426 It was written by Richard Stallman by simplifying the hairy parser
427 used when %semantic_parser is specified. */
428
429 #ifndef YYSTACK_USE_ALLOCA
430 #ifdef alloca
431 #define YYSTACK_USE_ALLOCA
432 #else /* alloca not defined */
433 #ifdef __GNUC__
434 #define YYSTACK_USE_ALLOCA
435 #define alloca __builtin_alloca
436 #else /* not GNU C. */
437 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
438 #define YYSTACK_USE_ALLOCA
439 #include <alloca.h>
440 #else /* not sparc */
441 /* We think this test detects Watcom and Microsoft C. */
442 rizwank 1.1 /* This used to test MSDOS, but that is a bad idea
443 since that symbol is in the user namespace. */
444 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
445 #if 0 /* No need for malloc.h, which pollutes the namespace;
446 instead, just don't use alloca. */
447 #include <malloc.h>
448 #endif
449 #else /* not MSDOS, or __TURBOC__ */
450 #if defined(_AIX)
451 /* I don't know what this was needed for, but it pollutes the namespace.
452 So I turned it off. rms, 2 May 1997. */
453 /* #include <malloc.h> */
454 #pragma alloca
455 #define YYSTACK_USE_ALLOCA
456 #else /* not MSDOS, or __TURBOC__, or _AIX */
457 #if 0
458 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
459 and on HPUX 10. Eventually we can turn this on. */
460 #define YYSTACK_USE_ALLOCA
461 #define alloca __builtin_alloca
462 #endif /* __hpux */
463 rizwank 1.1 #endif
464 #endif /* not _AIX */
465 #endif /* not MSDOS, or __TURBOC__ */
466 #endif /* not sparc */
467 #endif /* not GNU C */
468 #endif /* alloca not defined */
469 #endif /* YYSTACK_USE_ALLOCA not defined */
470
471 #ifdef YYSTACK_USE_ALLOCA
472 #define YYSTACK_ALLOC alloca
473 #else
474 #define YYSTACK_ALLOC malloc
475 #endif
476
477 /* Note: there must be only one dollar sign in this file.
478 It is replaced by the list of actions, each action
479 as one case of the switch. */
480
481 #define yyerrok (yyerrstatus = 0)
482 #define yyclearin (yychar = YYEMPTY)
483 #define YYEMPTY -2
484 rizwank 1.1 #define YYEOF 0
485 #define YYACCEPT goto yyacceptlab
486 #define YYABORT goto yyabortlab
487 #define YYERROR goto yyerrlab1
488 /* Like YYERROR except do call yyerror.
489 This remains here temporarily to ease the
490 transition to the new meaning of YYERROR, for GCC.
491 Once GCC version 2 has supplanted version 1, this can go. */
492 #define YYFAIL goto yyerrlab
493 #define YYRECOVERING() (!!yyerrstatus)
494 #define YYBACKUP(token, value) \
495 do \
496 if (yychar == YYEMPTY && yylen == 1) \
497 { yychar = (token), yylval = (value); \
498 yychar1 = YYTRANSLATE (yychar); \
499 YYPOPSTACK; \
500 goto yybackup; \
501 } \
502 else \
503 { yyerror ("syntax error: cannot back up"); YYERROR; } \
504 while (0)
505 rizwank 1.1
506 #define YYTERROR 1
507 #define YYERRCODE 256
508
509 #ifndef YYPURE
510 #define YYLEX yylex()
511 #endif
512
513 #ifdef YYPURE
514 #ifdef YYLSP_NEEDED
515 #ifdef YYLEX_PARAM
516 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
517 #else
518 #define YYLEX yylex(&yylval, &yylloc)
519 #endif
520 #else /* not YYLSP_NEEDED */
521 #ifdef YYLEX_PARAM
522 #define YYLEX yylex(&yylval, YYLEX_PARAM)
523 #else
524 #define YYLEX yylex(&yylval)
525 #endif
526 rizwank 1.1 #endif /* not YYLSP_NEEDED */
527 #endif
528
529 /* If nonreentrant, generate the variables here */
530
531 #ifndef YYPURE
532
533 int yychar; /* the lookahead symbol */
534 YYSTYPE yylval; /* the semantic value of the */
535 /* lookahead symbol */
536
537 #ifdef YYLSP_NEEDED
538 YYLTYPE yylloc; /* location data for the lookahead */
539 /* symbol */
540 #endif
541
542 int yynerrs; /* number of parse errors so far */
543 #endif /* not YYPURE */
544
545 #if YYDEBUG != 0
546 int yydebug; /* nonzero means print parse trace */
547 rizwank 1.1 /* Since this is uninitialized, it does not stop multiple parsers
548 from coexisting. */
549 #endif
550
551 /* YYINITDEPTH indicates the initial size of the parser's stacks */
552
553 #ifndef YYINITDEPTH
554 #define YYINITDEPTH 200
555 #endif
556
557 /* YYMAXDEPTH is the maximum size the stacks can grow to
558 (effective only if the built-in stack extension method is used). */
559
560 #if YYMAXDEPTH == 0
561 #undef YYMAXDEPTH
562 #endif
563
564 #ifndef YYMAXDEPTH
565 #define YYMAXDEPTH 10000
566 #endif
567
568 rizwank 1.1 /* Define __yy_memcpy. Note that the size argument
569 should be passed with type unsigned int, because that is what the non-GCC
570 definitions require. With GCC, __builtin_memcpy takes an arg
571 of type size_t, but it can handle unsigned int. */
572
573 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
574 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
575 #else /* not GNU C or C++ */
576 #ifndef __cplusplus
577
578 /* This is the most reliable way to avoid incompatibilities
579 in available built-in functions on various systems. */
580 static void
581 __yy_memcpy (to, from, count)
582 char *to;
583 char *from;
584 unsigned int count;
585 {
586 register char *f = from;
587 register char *t = to;
588 register int i = count;
589 rizwank 1.1
590 while (i-- > 0)
591 *t++ = *f++;
592 }
593
594 #else /* __cplusplus */
595
596 /* This is the most reliable way to avoid incompatibilities
597 in available built-in functions on various systems. */
598 static void
599 __yy_memcpy (char *to, char *from, unsigned int count)
600 {
601 register char *t = to;
602 register char *f = from;
603 register int i = count;
604
605 while (i-- > 0)
606 *t++ = *f++;
607 }
608
609 #endif
610 rizwank 1.1 #endif
611
612 #line 217 "/l/mtr/gnu/share/bison.simple"
613
614 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
615 into yyparse. The argument should have type void *.
616 It should actually point to an object.
617 Grammar actions can access the variable by casting it
618 to the proper pointer type. */
619
620 #ifdef YYPARSE_PARAM
621 #ifdef __cplusplus
622 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
623 #define YYPARSE_PARAM_DECL
624 #else /* not __cplusplus */
625 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
626 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
627 #endif /* not __cplusplus */
628 #else /* not YYPARSE_PARAM */
629 #define YYPARSE_PARAM_ARG
630 #define YYPARSE_PARAM_DECL
631 rizwank 1.1 #endif /* not YYPARSE_PARAM */
632
633 /* Prevent warning if -Wstrict-prototypes. */
634 #ifdef __GNUC__
635 #ifdef YYPARSE_PARAM
636 int yyparse (void *);
637 #else
638 int yyparse (void);
639 #endif
640 #endif
641
642 int
643 yyparse(YYPARSE_PARAM_ARG)
644 YYPARSE_PARAM_DECL
645 {
646 register int yystate;
647 register int yyn;
648 register short *yyssp;
649 register YYSTYPE *yyvsp;
650 int yyerrstatus; /* number of tokens to shift before error messages enabled */
651 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
652 rizwank 1.1
653 short yyssa[YYINITDEPTH]; /* the state stack */
654 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
655
656 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
657 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
658
659 #ifdef YYLSP_NEEDED
660 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
661 YYLTYPE *yyls = yylsa;
662 YYLTYPE *yylsp;
663
664 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
665 #else
666 #define YYPOPSTACK (yyvsp--, yyssp--)
667 #endif
668
669 int yystacksize = YYINITDEPTH;
670 int yyfree_stacks = 0;
671
672 #ifdef YYPURE
673 rizwank 1.1 int yychar;
674 YYSTYPE yylval;
675 int yynerrs;
676 #ifdef YYLSP_NEEDED
677 YYLTYPE yylloc;
678 #endif
679 #endif
680
681 YYSTYPE yyval; /* the variable used to return */
682 /* semantic values from the action */
683 /* routines */
684
685 int yylen;
686
687 #if YYDEBUG != 0
688 if (yydebug)
689 fprintf(stderr, "Starting parse\n");
690 #endif
691
692 yystate = 0;
693 yyerrstatus = 0;
694 rizwank 1.1 yynerrs = 0;
695 yychar = YYEMPTY; /* Cause a token to be read. */
696
697 /* Initialize stack pointers.
698 Waste one element of value and location stack
699 so that they stay on the same level as the state stack.
700 The wasted elements are never initialized. */
701
702 yyssp = yyss - 1;
703 yyvsp = yyvs;
704 #ifdef YYLSP_NEEDED
705 yylsp = yyls;
706 #endif
707
708 /* Push a new state, which is found in yystate . */
709 /* In all cases, when you get here, the value and location stacks
710 have just been pushed. so pushing a state here evens the stacks. */
711 yynewstate:
712
713 *++yyssp = yystate;
714
715 rizwank 1.1 if (yyssp >= yyss + yystacksize - 1)
716 {
717 /* Give user a chance to reallocate the stack */
718 /* Use copies of these so that the &'s don't force the real ones into memory. */
719 YYSTYPE *yyvs1 = yyvs;
720 short *yyss1 = yyss;
721 #ifdef YYLSP_NEEDED
722 YYLTYPE *yyls1 = yyls;
723 #endif
724
725 /* Get the current used size of the three stacks, in elements. */
726 int size = yyssp - yyss + 1;
727
728 #ifdef yyoverflow
729 /* Each stack pointer address is followed by the size of
730 the data in use in that stack, in bytes. */
731 #ifdef YYLSP_NEEDED
732 /* This used to be a conditional around just the two extra args,
733 but that might be undefined if yyoverflow is a macro. */
734 yyoverflow("parser stack overflow",
735 &yyss1, size * sizeof (*yyssp),
736 rizwank 1.1 &yyvs1, size * sizeof (*yyvsp),
737 &yyls1, size * sizeof (*yylsp),
738 &yystacksize);
739 #else
740 yyoverflow("parser stack overflow",
741 &yyss1, size * sizeof (*yyssp),
742 &yyvs1, size * sizeof (*yyvsp),
743 &yystacksize);
744 #endif
745
746 yyss = yyss1; yyvs = yyvs1;
747 #ifdef YYLSP_NEEDED
748 yyls = yyls1;
749 #endif
750 #else /* no yyoverflow */
751 /* Extend the stack our own way. */
752 if (yystacksize >= YYMAXDEPTH)
753 {
754 yyerror("parser stack overflow");
755 if (yyfree_stacks)
756 {
757 rizwank 1.1 free (yyss);
758 free (yyvs);
759 #ifdef YYLSP_NEEDED
760 free (yyls);
761 #endif
762 }
763 return 2;
764 }
765 yystacksize *= 2;
766 if (yystacksize > YYMAXDEPTH)
767 yystacksize = YYMAXDEPTH;
768 #ifndef YYSTACK_USE_ALLOCA
769 yyfree_stacks = 1;
770 #endif
771 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
772 __yy_memcpy ((char *)yyss, (char *)yyss1,
773 size * (unsigned int) sizeof (*yyssp));
774 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
775 __yy_memcpy ((char *)yyvs, (char *)yyvs1,
776 size * (unsigned int) sizeof (*yyvsp));
777 #ifdef YYLSP_NEEDED
778 rizwank 1.1 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
779 __yy_memcpy ((char *)yyls, (char *)yyls1,
780 size * (unsigned int) sizeof (*yylsp));
781 #endif
782 #endif /* no yyoverflow */
783
784 yyssp = yyss + size - 1;
785 yyvsp = yyvs + size - 1;
786 #ifdef YYLSP_NEEDED
787 yylsp = yyls + size - 1;
788 #endif
789
790 #if YYDEBUG != 0
791 if (yydebug)
792 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
793 #endif
794
795 if (yyssp >= yyss + yystacksize - 1)
796 YYABORT;
797 }
798
799 rizwank 1.1 #if YYDEBUG != 0
800 if (yydebug)
801 fprintf(stderr, "Entering state %d\n", yystate);
802 #endif
803
804 goto yybackup;
805 yybackup:
806
807 /* Do appropriate processing given the current state. */
808 /* Read a lookahead token if we need one and don't already have one. */
809 /* yyresume: */
810
811 /* First try to decide what to do without reference to lookahead token. */
812
813 yyn = yypact[yystate];
814 if (yyn == YYFLAG)
815 goto yydefault;
816
817 /* Not known => get a lookahead token if don't already have one. */
818
819 /* yychar is either YYEMPTY or YYEOF
820 rizwank 1.1 or a valid token in external form. */
821
822 if (yychar == YYEMPTY)
823 {
824 #if YYDEBUG != 0
825 if (yydebug)
826 fprintf(stderr, "Reading a token: ");
827 #endif
828 yychar = YYLEX;
829 }
830
831 /* Convert token to internal form (in yychar1) for indexing tables with */
832
833 if (yychar <= 0) /* This means end of input. */
834 {
835 yychar1 = 0;
836 yychar = YYEOF; /* Don't call YYLEX any more */
837
838 #if YYDEBUG != 0
839 if (yydebug)
840 fprintf(stderr, "Now at end of input.\n");
841 rizwank 1.1 #endif
842 }
843 else
844 {
845 yychar1 = YYTRANSLATE(yychar);
846
847 #if YYDEBUG != 0
848 if (yydebug)
849 {
850 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
851 /* Give the individual parser a way to print the precise meaning
852 of a token, for further debugging info. */
853 #ifdef YYPRINT
854 YYPRINT (stderr, yychar, yylval);
855 #endif
856 fprintf (stderr, ")\n");
857 }
858 #endif
859 }
860
861 yyn += yychar1;
862 rizwank 1.1 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
863 goto yydefault;
864
865 yyn = yytable[yyn];
866
867 /* yyn is what to do for this token type in this state.
868 Negative => reduce, -yyn is rule number.
869 Positive => shift, yyn is new state.
870 New state is final state => don't bother to shift,
871 just return success.
872 0, or most negative number => error. */
873
874 if (yyn < 0)
875 {
876 if (yyn == YYFLAG)
877 goto yyerrlab;
878 yyn = -yyn;
879 goto yyreduce;
880 }
881 else if (yyn == 0)
882 goto yyerrlab;
883 rizwank 1.1
884 if (yyn == YYFINAL)
885 YYACCEPT;
886
887 /* Shift the lookahead token. */
888
889 #if YYDEBUG != 0
890 if (yydebug)
891 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
892 #endif
893
894 /* Discard the token being shifted unless it is eof. */
895 if (yychar != YYEOF)
896 yychar = YYEMPTY;
897
898 *++yyvsp = yylval;
899 #ifdef YYLSP_NEEDED
900 *++yylsp = yylloc;
901 #endif
902
903 /* count tokens shifted since error; after three, turn off error status. */
904 rizwank 1.1 if (yyerrstatus) yyerrstatus--;
905
906 yystate = yyn;
907 goto yynewstate;
908
909 /* Do the default action for the current state. */
910 yydefault:
911
912 yyn = yydefact[yystate];
913 if (yyn == 0)
914 goto yyerrlab;
915
916 /* Do a reduction. yyn is the number of a rule to reduce with. */
917 yyreduce:
918 yylen = yyr2[yyn];
919 if (yylen > 0)
920 yyval = yyvsp[1-yylen]; /* implement default value of the action */
921
922 #if YYDEBUG != 0
923 if (yydebug)
924 {
925 rizwank 1.1 int i;
926
927 fprintf (stderr, "Reducing via rule %d (line %d), ",
928 yyn, yyrline[yyn]);
929
930 /* Print the symbols being reduced, and their result. */
931 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
932 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
933 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
934 }
935 #endif
936
937
938 switch (yyn) {
939
940 case 3:
941 #line 71 "gram.y"
942 { start_stmts = yyvsp[-1].lst; ;
943 break;}
944 case 4:
945 #line 73 "gram.y"
946 rizwank 1.1 { startrules = yyvsp[-1].lst; ;
947 break;}
948 case 5:
949 #line 75 "gram.y"
950 { namerules = yyvsp[-1].lst; ;
951 break;}
952 case 6:
953 #line 77 "gram.y"
954 { define_state (yyvsp[-3].node, NULL, yyvsp[-1].lst); ;
955 break;}
956 case 7:
957 #line 79 "gram.y"
958 { define_state (yyvsp[-5].node, yyvsp[-3].node, yyvsp[-1].lst); ;
959 break;}
960 case 8:
961 #line 80 "gram.y"
962 { list_append (global_stmts, yyvsp[0].stmt); ;
963 break;}
964 case 9:
965 #line 83 "gram.y"
966 { yyval.lst = list (); ;
967 rizwank 1.1 break;}
968 case 10:
969 #line 85 "gram.y"
970 { list_append (yyvsp[-3].lst, cons (yyvsp[-2].node, yyvsp[-1].node)); ;
971 break;}
972 case 11:
973 #line 88 "gram.y"
974 { yyval.lst = list (); ;
975 break;}
976 case 12:
977 #line 89 "gram.y"
978 { list_append (yyvsp[-1].lst, yyvsp[0].cons); ;
979 break;}
980 case 13:
981 #line 91 "gram.y"
982 { yyval.cons = cons (RULE_BEGIN, yyvsp[-1].lst); ;
983 break;}
984 case 14:
985 #line 92 "gram.y"
986 { yyval.cons = cons (RULE_END, yyvsp[-1].lst); ;
987 break;}
988 rizwank 1.1 case 15:
989 #line 93 "gram.y"
990 { yyval.cons = cons (yyvsp[-3].node, yyvsp[-1].lst); ;
991 break;}
992 case 16:
993 #line 94 "gram.y"
994 { yyval.cons = cons (yyvsp[-3].node, yyvsp[-1].lst); ;
995 break;}
996 case 17:
997 #line 97 "gram.y"
998 { yyval.lst = list (); ;
999 break;}
1000 case 18:
1001 #line 98 "gram.y"
1002 { yyval.lst = yyvsp[0].lst; ;
1003 break;}
1004 case 19:
1005 #line 101 "gram.y"
1006 { yyval.lst = list (); list_append (yyval.lst, yyvsp[0].node); ;
1007 break;}
1008 case 20:
1009 rizwank 1.1 #line 102 "gram.y"
1010 { list_append (yyvsp[-2].lst, yyvsp[0].node); ;
1011 break;}
1012 case 21:
1013 #line 105 "gram.y"
1014 { yyval.lst = list (); ;
1015 break;}
1016 case 22:
1017 #line 106 "gram.y"
1018 { yyval.lst = yyvsp[-1].lst; ;
1019 break;}
1020 case 23:
1021 #line 109 "gram.y"
1022 { yyval.lst = list (); list_append (yyval.lst, yyvsp[0].cons); ;
1023 break;}
1024 case 24:
1025 #line 110 "gram.y"
1026 { list_append (yyvsp[-2].lst, yyvsp[0].cons); ;
1027 break;}
1028 case 25:
1029 #line 113 "gram.y"
1030 rizwank 1.1 { yyval.cons = cons (yyvsp[0].node, NULL); ;
1031 break;}
1032 case 26:
1033 #line 114 "gram.y"
1034 { yyval.cons = cons (yyvsp[-2].node, yyvsp[0].expr); ;
1035 break;}
1036 case 27:
1037 #line 117 "gram.y"
1038 { yyval.lst = list (); ;
1039 break;}
1040 case 28:
1041 #line 118 "gram.y"
1042 { list_append (yyvsp[-1].lst, yyvsp[0].stmt); ;
1043 break;}
1044 case 29:
1045 #line 121 "gram.y"
1046 { yyval.stmt = mk_stmt (sRETURN, NULL, NULL,
1047 NULL, NULL); ;
1048 break;}
1049 case 30:
1050 #line 123 "gram.y"
1051 rizwank 1.1 { yyval.stmt = mk_stmt (sRETURN, yyvsp[-1].expr, NULL,
1052 NULL, NULL); ;
1053 break;}
1054 case 31:
1055 #line 126 "gram.y"
1056 { yyval.stmt = mk_stmt (sDEFSUB, yyvsp[-7].node,
1057 cons (cons (yyvsp[-5].lst, yyvsp[-2].lst),
1058 yyvsp[-1].lst),
1059 NULL, NULL); ;
1060 break;}
1061 case 32:
1062 #line 130 "gram.y"
1063 { yyval.stmt = mk_stmt (sBLOCK, yyvsp[-1].lst, NULL,
1064 NULL, NULL); ;
1065 break;}
1066 case 33:
1067 #line 132 "gram.y"
1068 { yyval.stmt = mk_stmt (sIF, yyvsp[-2].expr, yyvsp[0].stmt, NULL,
1069 NULL); ;
1070 break;}
1071 case 34:
1072 rizwank 1.1 #line 135 "gram.y"
1073 { yyval.stmt = mk_stmt (sIF, yyvsp[-4].expr, yyvsp[-2].stmt, yyvsp[0].stmt,
1074 NULL); ;
1075 break;}
1076 case 35:
1077 #line 137 "gram.y"
1078 { yyval.stmt = mk_stmt (sWHILE, yyvsp[-2].expr, yyvsp[0].stmt,
1079 NULL, NULL); ;
1080 break;}
1081 case 36:
1082 #line 140 "gram.y"
1083 { yyval.stmt = mk_stmt (sFOR, yyvsp[-6].expr, yyvsp[-4].expr, yyvsp[-2].expr,
1084 yyvsp[0].stmt); ;
1085 break;}
1086 case 37:
1087 #line 142 "gram.y"
1088 { yyval.stmt = mk_stmt (sEXPR, yyvsp[-1].expr, NULL,
1089 NULL, NULL); ;
1090 break;}
1091 case 38:
1092 #line 146 "gram.y"
1093 rizwank 1.1 { yyval.expr = mk_expr (eSTRING, yyvsp[0].node, NULL,
1094 NULL); ;
1095 break;}
1096 case 39:
1097 #line 148 "gram.y"
1098 { yyval.expr = mk_expr (eREGEXP, yyvsp[0].node, NULL,
1099 NULL); ;
1100 break;}
1101 case 40:
1102 #line 150 "gram.y"
1103 { yyval.expr = mk_expr (eINTEGER, yyvsp[0].node, NULL,
1104 NULL); ;
1105 break;}
1106 case 41:
1107 #line 152 "gram.y"
1108 { yyval.expr = mk_expr (eREAL, yyvsp[0].node, NULL,
1109 NULL); ;
1110 break;}
1111 case 42:
1112 #line 154 "gram.y"
1113 { yyval.expr = mk_expr (eSYMBOL, yyvsp[0].node, NULL,
1114 rizwank 1.1 NULL); ;
1115 break;}
1116 case 43:
1117 #line 156 "gram.y"
1118 { yyval.expr = mk_expr (eNOT, yyvsp[0].expr, NULL,
1119 NULL); ;
1120 break;}
1121 case 44:
1122 #line 158 "gram.y"
1123 { yyval.expr = mk_expr (eAND, yyvsp[-2].expr, yyvsp[0].expr, NULL); ;
1124 break;}
1125 case 45:
1126 #line 159 "gram.y"
1127 { yyval.expr = mk_expr (eOR, yyvsp[-2].expr, yyvsp[0].expr, NULL); ;
1128 break;}
1129 case 46:
1130 #line 160 "gram.y"
1131 { yyval.expr = mk_expr (eFCALL, yyvsp[-3].node, yyvsp[-1].lst,
1132 NULL); ;
1133 break;}
1134 case 47:
1135 rizwank 1.1 #line 162 "gram.y"
1136 { yyval.expr = mk_expr (eASSIGN, yyvsp[-2].node, yyvsp[0].expr,
1137 NULL); ;
1138 break;}
1139 case 48:
1140 #line 164 "gram.y"
1141 { yyval.expr = mk_expr (eADDASSIGN, yyvsp[-2].node, yyvsp[0].expr,
1142 NULL); ;
1143 break;}
1144 case 49:
1145 #line 166 "gram.y"
1146 { yyval.expr = mk_expr (eSUBASSIGN, yyvsp[-2].node, yyvsp[0].expr,
1147 NULL); ;
1148 break;}
1149 case 50:
1150 #line 168 "gram.y"
1151 { yyval.expr = mk_expr (eMULASSIGN, yyvsp[-2].node, yyvsp[0].expr,
1152 NULL); ;
1153 break;}
1154 case 51:
1155 #line 170 "gram.y"
1156 rizwank 1.1 { yyval.expr = mk_expr (eDIVASSIGN, yyvsp[-2].node, yyvsp[0].expr,
1157 NULL); ;
1158 break;}
1159 case 52:
1160 #line 172 "gram.y"
1161 { yyval.expr = mk_expr (ePOSTFIXADD, yyvsp[-1].node, NULL,
1162 NULL); ;
1163 break;}
1164 case 53:
1165 #line 174 "gram.y"
1166 { yyval.expr = mk_expr (ePOSTFIXSUB, yyvsp[-1].node, NULL,
1167 NULL); ;
1168 break;}
1169 case 54:
1170 #line 176 "gram.y"
1171 { yyval.expr = mk_expr (ePREFIXADD, yyvsp[0].node, NULL,
1172 NULL); ;
1173 break;}
1174 case 55:
1175 #line 178 "gram.y"
1176 { yyval.expr = mk_expr (ePREFIXSUB, yyvsp[0].node, NULL,
1177 rizwank 1.1 NULL); ;
1178 break;}
1179 case 56:
1180 #line 180 "gram.y"
1181 { yyval.expr = mk_expr (eARRAYASSIGN, yyvsp[-5].expr, yyvsp[-3].expr,
1182 yyvsp[0].expr); ;
1183 break;}
1184 case 57:
1185 #line 182 "gram.y"
1186 { yyval.expr = yyvsp[-1].expr; ;
1187 break;}
1188 case 58:
1189 #line 183 "gram.y"
1190 { yyval.expr = mk_expr (eARRAYREF, yyvsp[-3].expr, yyvsp[-1].expr,
1191 NULL); ;
1192 break;}
1193 case 59:
1194 #line 185 "gram.y"
1195 { yyval.expr = mk_expr (eQUESTCOLON, yyvsp[-4].expr, yyvsp[-2].expr,
1196 yyvsp[0].expr); ;
1197 break;}
1198 rizwank 1.1 case 60:
1199 #line 187 "gram.y"
1200 { yyval.expr = mk_expr (eMULT, yyvsp[-2].expr, yyvsp[0].expr, NULL); ;
1201 break;}
1202 case 61:
1203 #line 188 "gram.y"
1204 { yyval.expr = mk_expr (eDIV, yyvsp[-2].expr, yyvsp[0].expr, NULL); ;
1205 break;}
1206 case 62:
1207 #line 189 "gram.y"
1208 { yyval.expr = mk_expr (ePLUS, yyvsp[-2].expr, yyvsp[0].expr, NULL); ;
1209 break;}
1210 case 63:
1211 #line 190 "gram.y"
1212 { yyval.expr = mk_expr (eMINUS, yyvsp[-2].expr, yyvsp[0].expr,
1213 NULL); ;
1214 break;}
1215 case 64:
1216 #line 192 "gram.y"
1217 { yyval.expr = mk_expr (eLT, yyvsp[-2].expr, yyvsp[0].expr, NULL); ;
1218 break;}
1219 rizwank 1.1 case 65:
1220 #line 193 "gram.y"
1221 { yyval.expr = mk_expr (eGT, yyvsp[-2].expr, yyvsp[0].expr, NULL); ;
1222 break;}
1223 case 66:
1224 #line 194 "gram.y"
1225 { yyval.expr = mk_expr (eEQ, yyvsp[-2].expr, yyvsp[0].expr, NULL); ;
1226 break;}
1227 case 67:
1228 #line 195 "gram.y"
1229 { yyval.expr = mk_expr (eNE, yyvsp[-2].expr, yyvsp[0].expr, NULL); ;
1230 break;}
1231 case 68:
1232 #line 196 "gram.y"
1233 { yyval.expr = mk_expr (eGE, yyvsp[-2].expr, yyvsp[0].expr, NULL); ;
1234 break;}
1235 case 69:
1236 #line 197 "gram.y"
1237 { yyval.expr = mk_expr (eLE, yyvsp[-2].expr, yyvsp[0].expr, NULL); ;
1238 break;}
1239 case 70:
1240 rizwank 1.1 #line 200 "gram.y"
1241 { yyval.expr = NULL; ;
1242 break;}
1243 case 71:
1244 #line 201 "gram.y"
1245 { yyval.expr = yyvsp[0].expr; ;
1246 break;}
1247 case 72:
1248 #line 204 "gram.y"
1249 { yyval.lst = list (); ;
1250 break;}
1251 case 73:
1252 #line 205 "gram.y"
1253 { yyval.lst = yyvsp[0].lst; ;
1254 break;}
1255 case 74:
1256 #line 208 "gram.y"
1257 { yyval.lst = list (); list_append (yyval.lst, yyvsp[0].expr); ;
1258 break;}
1259 case 75:
1260 #line 209 "gram.y"
1261 rizwank 1.1 { list_append (yyvsp[-2].lst, yyvsp[0].expr); ;
1262 break;}
1263 }
1264 /* the action file gets copied in in place of this dollarsign */
1265 #line 543 "/l/mtr/gnu/share/bison.simple"
1266
1267 yyvsp -= yylen;
1268 yyssp -= yylen;
1269 #ifdef YYLSP_NEEDED
1270 yylsp -= yylen;
1271 #endif
1272
1273 #if YYDEBUG != 0
1274 if (yydebug)
1275 {
1276 short *ssp1 = yyss - 1;
1277 fprintf (stderr, "state stack now");
1278 while (ssp1 != yyssp)
1279 fprintf (stderr, " %d", *++ssp1);
1280 fprintf (stderr, "\n");
1281 }
1282 rizwank 1.1 #endif
1283
1284 *++yyvsp = yyval;
1285
1286 #ifdef YYLSP_NEEDED
1287 yylsp++;
1288 if (yylen == 0)
1289 {
1290 yylsp->first_line = yylloc.first_line;
1291 yylsp->first_column = yylloc.first_column;
1292 yylsp->last_line = (yylsp-1)->last_line;
1293 yylsp->last_column = (yylsp-1)->last_column;
1294 yylsp->text = 0;
1295 }
1296 else
1297 {
1298 yylsp->last_line = (yylsp+yylen-1)->last_line;
1299 yylsp->last_column = (yylsp+yylen-1)->last_column;
1300 }
1301 #endif
1302
1303 rizwank 1.1 /* Now "shift" the result of the reduction.
1304 Determine what state that goes to,
1305 based on the state we popped back to
1306 and the rule number reduced by. */
1307
1308 yyn = yyr1[yyn];
1309
1310 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
1311 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1312 yystate = yytable[yystate];
1313 else
1314 yystate = yydefgoto[yyn - YYNTBASE];
1315
1316 goto yynewstate;
1317
1318 yyerrlab: /* here on detecting error */
1319
1320 if (! yyerrstatus)
1321 /* If not already recovering from an error, report this error. */
1322 {
1323 ++yynerrs;
1324 rizwank 1.1
1325 #ifdef YYERROR_VERBOSE
1326 yyn = yypact[yystate];
1327
1328 if (yyn > YYFLAG && yyn < YYLAST)
1329 {
1330 int size = 0;
1331 char *msg;
1332 int x, count;
1333
1334 count = 0;
1335 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
1336 for (x = (yyn < 0 ? -yyn : 0);
1337 x < (sizeof(yytname) / sizeof(char *)); x++)
1338 if (yycheck[x + yyn] == x)
1339 size += strlen(yytname[x]) + 15, count++;
1340 msg = (char *) malloc(size + 15);
1341 if (msg != 0)
1342 {
1343 strcpy(msg, "parse error");
1344
1345 rizwank 1.1 if (count < 5)
1346 {
1347 count = 0;
1348 for (x = (yyn < 0 ? -yyn : 0);
1349 x < (sizeof(yytname) / sizeof(char *)); x++)
1350 if (yycheck[x + yyn] == x)
1351 {
1352 strcat(msg, count == 0 ? ", expecting `" : " or `");
1353 strcat(msg, yytname[x]);
1354 strcat(msg, "'");
1355 count++;
1356 }
1357 }
1358 yyerror(msg);
1359 free(msg);
1360 }
1361 else
1362 yyerror ("parse error; also virtual memory exceeded");
1363 }
1364 else
1365 #endif /* YYERROR_VERBOSE */
1366 rizwank 1.1 yyerror("parse error");
1367 }
1368
1369 goto yyerrlab1;
1370 yyerrlab1: /* here on error raised explicitly by an action */
1371
1372 if (yyerrstatus == 3)
1373 {
1374 /* if just tried and failed to reuse lookahead token after an error, discard it. */
1375
1376 /* return failure if at end of input */
1377 if (yychar == YYEOF)
1378 YYABORT;
1379
1380 #if YYDEBUG != 0
1381 if (yydebug)
1382 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
1383 #endif
1384
1385 yychar = YYEMPTY;
1386 }
1387 rizwank 1.1
1388 /* Else will try to reuse lookahead token
1389 after shifting the error token. */
1390
1391 yyerrstatus = 3; /* Each real token shifted decrements this */
1392
1393 goto yyerrhandle;
1394
1395 yyerrdefault: /* current state does not do anything special for the error token. */
1396
1397 #if 0
1398 /* This is wrong; only states that explicitly want error tokens
1399 should shift them. */
1400 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
1401 if (yyn) goto yydefault;
1402 #endif
1403
1404 yyerrpop: /* pop the current state because it cannot handle the error token */
1405
1406 if (yyssp == yyss) YYABORT;
1407 yyvsp--;
1408 rizwank 1.1 yystate = *--yyssp;
1409 #ifdef YYLSP_NEEDED
1410 yylsp--;
1411 #endif
1412
1413 #if YYDEBUG != 0
1414 if (yydebug)
1415 {
1416 short *ssp1 = yyss - 1;
1417 fprintf (stderr, "Error: state stack now");
1418 while (ssp1 != yyssp)
1419 fprintf (stderr, " %d", *++ssp1);
1420 fprintf (stderr, "\n");
1421 }
1422 #endif
1423
1424 yyerrhandle:
1425
1426 yyn = yypact[yystate];
1427 if (yyn == YYFLAG)
1428 goto yyerrdefault;
1429 rizwank 1.1
1430 yyn += YYTERROR;
1431 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
1432 goto yyerrdefault;
1433
1434 yyn = yytable[yyn];
1435 if (yyn < 0)
1436 {
1437 if (yyn == YYFLAG)
1438 goto yyerrpop;
1439 yyn = -yyn;
1440 goto yyreduce;
1441 }
1442 else if (yyn == 0)
1443 goto yyerrpop;
1444
1445 if (yyn == YYFINAL)
1446 YYACCEPT;
1447
1448 #if YYDEBUG != 0
1449 if (yydebug)
1450 rizwank 1.1 fprintf(stderr, "Shifting error token, ");
1451 #endif
1452
1453 *++yyvsp = yylval;
1454 #ifdef YYLSP_NEEDED
1455 *++yylsp = yylloc;
1456 #endif
1457
1458 yystate = yyn;
1459 goto yynewstate;
1460
1461 yyacceptlab:
1462 /* YYACCEPT comes here. */
1463 if (yyfree_stacks)
1464 {
1465 free (yyss);
1466 free (yyvs);
1467 #ifdef YYLSP_NEEDED
1468 free (yyls);
1469 #endif
1470 }
1471 rizwank 1.1 return 0;
1472
1473 yyabortlab:
1474 /* YYABORT comes here. */
1475 if (yyfree_stacks)
1476 {
1477 free (yyss);
1478 free (yyvs);
1479 #ifdef YYLSP_NEEDED
1480 free (yyls);
1481 #endif
1482 }
1483 return 1;
1484 }
1485 #line 212 "gram.y"
1486
1487
1488 void
1489 yyerror (msg)
1490 char *msg;
1491 {
1492 rizwank 1.1 fprintf (stderr, "%s:%d: %s\n", yyin_name, linenum, msg);
1493 }
|