1 /* original parser id follows */
2 /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
3 /* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
4
5 #define YYBYACC 1
6 #define YYMAJOR 2
7 #define YYMINOR 0
8 #define YYCHECK "yyyymmdd"
9
10 #define YYEMPTY (-1)
11 #define yyclearin (yychar = YYEMPTY)
12 #define yyerrok (yyerrflag = 0)
13 #define YYRECOVERING() (yyerrflag != 0)
14 #define YYENOMEM (-2)
15 #define YYEOF 0
16 #ident "check variant syntax features"
17 #undef YYBTYACC
18 #define YYBTYACC 0
19 #define YYDEBUGSTR YYPREFIX "debug"
20
21 #ifndef yyparse
22 #define yyparse varsyntax_calc1_parse
23 #endif /* yyparse */
24
25 #ifndef yylex
26 #define yylex varsyntax_calc1_lex
27 #endif /* yylex */
28
29 #ifndef yyerror
30 #define yyerror varsyntax_calc1_error
31 #endif /* yyerror */
32
33 #ifndef yychar
34 #define yychar varsyntax_calc1_char
35 #endif /* yychar */
36
37 #ifndef yyval
38 #define yyval varsyntax_calc1_val
39 #endif /* yyval */
40
41 #ifndef yylval
42 #define yylval varsyntax_calc1_lval
43 #endif /* yylval */
44
45 #ifndef yydebug
46 #define yydebug varsyntax_calc1_debug
47 #endif /* yydebug */
48
49 #ifndef yynerrs
50 #define yynerrs varsyntax_calc1_nerrs
51 #endif /* yynerrs */
52
53 #ifndef yyerrflag
54 #define yyerrflag varsyntax_calc1_errflag
55 #endif /* yyerrflag */
56
57 #ifndef yylhs
58 #define yylhs varsyntax_calc1_lhs
59 #endif /* yylhs */
60
61 #ifndef yylen
62 #define yylen varsyntax_calc1_len
63 #endif /* yylen */
64
65 #ifndef yydefred
66 #define yydefred varsyntax_calc1_defred
67 #endif /* yydefred */
68
69 #ifndef yystos
70 #define yystos varsyntax_calc1_stos
71 #endif /* yystos */
72
73 #ifndef yydgoto
74 #define yydgoto varsyntax_calc1_dgoto
75 #endif /* yydgoto */
76
77 #ifndef yysindex
78 #define yysindex varsyntax_calc1_sindex
79 #endif /* yysindex */
80
81 #ifndef yyrindex
82 #define yyrindex varsyntax_calc1_rindex
83 #endif /* yyrindex */
84
85 #ifndef yygindex
86 #define yygindex varsyntax_calc1_gindex
87 #endif /* yygindex */
88
89 #ifndef yytable
90 #define yytable varsyntax_calc1_table
91 #endif /* yytable */
92
93 #ifndef yycheck
94 #define yycheck varsyntax_calc1_check
95 #endif /* yycheck */
96
97 #ifndef yyname
98 #define yyname varsyntax_calc1_name
99 #endif /* yyname */
100
101 #ifndef yyrule
102 #define yyrule varsyntax_calc1_rule
103 #endif /* yyrule */
104
105 #if YYBTYACC
106
107 #ifndef yycindex
108 #define yycindex varsyntax_calc1_cindex
109 #endif /* yycindex */
110
111 #ifndef yyctable
112 #define yyctable varsyntax_calc1_ctable
113 #endif /* yyctable */
114
115 #endif /* YYBTYACC */
116
117 #define YYPREFIX "varsyntax_calc1_"
118
119 #define YYPURE 0
120
121 #line 3 "varsyntax_calc1.y"
122
123 /* http://dinosaur.compilertools.net/yacc/index.html * /*/
124
125 #include <stdlib.h>
126 #include <stdio.h>
127 #include <ctype.h>
128 #include <math.h>
129
130 typedef struct interval
131 {
132 double lo, hi;
133 }
134 INTERVAL;
135
136 INTERVAL vmul(double, double, INTERVAL);
137 INTERVAL vdiv(double, double, INTERVAL);
138
139 extern int yylex(void);
140 static void yyerror(const char *s);
141
142 int dcheck(INTERVAL);
143
144 double dreg[26];
145 INTERVAL vreg[26];
146
147 #ifdef YYSTYPE
148 #undef YYSTYPE_IS_DECLARED
149 #define YYSTYPE_IS_DECLARED 1
150 #endif
151 #ifndef YYSTYPE_IS_DECLARED
152 #define YYSTYPE_IS_DECLARED 1
153 #line 32 "varsyntax_calc1.y"
154 typedef union YYSTYPE
155 {
156 int ival; /* dreg & vreg array index values*/
157 double dval; /* floating point values*/
158 INTERVAL vval; /* interval values*/
159 } YYSTYPE;
160 #endif /* !YYSTYPE_IS_DECLARED */
161 #line 162 "varsyntax_calc1.tab.c"
162
163 /* compatibility with bison */
164 #ifdef YYPARSE_PARAM
165 /* compatibility with FreeBSD */
166 # ifdef YYPARSE_PARAM_TYPE
167 # define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
168 # else
169 # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
170 # endif
171 #else
172 # define YYPARSE_DECL() yyparse(void)
173 #endif
174
175 /* Parameters sent to lex. */
176 #ifdef YYLEX_PARAM
177 # define YYLEX_DECL() yylex(void *YYLEX_PARAM)
178 # define YYLEX yylex(YYLEX_PARAM)
179 #else
180 # define YYLEX_DECL() yylex(void)
181 # define YYLEX yylex()
182 #endif
183
184 /* Parameters sent to yyerror. */
185 #ifndef YYERROR_DECL
186 #define YYERROR_DECL() yyerror(const char *s)
187 #endif
188 #ifndef YYERROR_CALL
189 #define YYERROR_CALL(msg) yyerror(msg)
190 #endif
191
192 extern int YYPARSE_DECL();
193
194 #define DREG 257
195 #define VREG 258
196 #define CONST 259
197 #define UMINUS 260
198 #define YYERRCODE 256
199 typedef int YYINT;
200 static const YYINT varsyntax_calc1_lhs[] = { -1,
201 3, 3, 0, 0, 0, 0, 0, 1, 1, 1,
202 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
203 2, 2, 2, 2, 2, 2, 2, 2,
204 };
205 static const YYINT varsyntax_calc1_len[] = { 2,
206 0, 2, 2, 2, 4, 4, 2, 1, 1, 3,
207 3, 3, 3, 2, 3, 1, 5, 1, 3, 3,
208 3, 3, 3, 3, 3, 3, 2, 3,
209 };
210 static const YYINT varsyntax_calc1_defred[] = { 0,
211 0, 0, 0, 8, 0, 0, 0, 0, 0, 7,
212 0, 0, 9, 18, 14, 27, 0, 0, 0, 0,
213 0, 0, 3, 0, 0, 0, 0, 4, 0, 0,
214 0, 0, 0, 15, 0, 28, 0, 0, 0, 0,
215 12, 24, 13, 26, 0, 0, 23, 25, 14, 0,
216 0, 0, 0, 0, 5, 6, 0, 0, 0, 12,
217 13, 17,
218 };
219 #if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING)
220 static const YYINT varsyntax_calc1_stos[] = { 0,
221 256, 257, 258, 259, 45, 40, 262, 263, 264, 10,
222 61, 61, 257, 258, 263, 264, 263, 264, 43, 45,
223 42, 47, 10, 43, 45, 42, 47, 10, 45, 40,
224 263, 263, 264, 41, 44, 41, 263, 264, 263, 264,
225 263, 264, 263, 264, 264, 264, 264, 264, 263, 263,
226 43, 45, 42, 47, 10, 10, 263, 263, 263, 263,
227 263, 41,
228 };
229 #endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */
230 static const YYINT varsyntax_calc1_dgoto[] = { 7,
231 32, 9, 0,
232 };
233 static const YYINT varsyntax_calc1_sindex[] = { -40,
234 -8, -48, -47, 0, -37, -37, 0, 2, 17, 0,
235 -34, -37, 0, 0, 0, 0, -25, 90, -37, -37,
236 -37, -37, 0, -37, -37, -37, -37, 0, -34, -34,
237 25, 125, 31, 0, -34, 0, -11, 37, -11, 37,
238 0, 0, 0, 0, 37, 37, 0, 0, 0, 111,
239 -34, -34, -34, -34, 0, 0, 118, 69, 69, 0,
240 0, 0,
241 };
242 static const YYINT varsyntax_calc1_rindex[] = { 0,
243 0, 38, 44, 0, 0, 0, 0, 0, 0, 0,
244 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
245 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
246 0, -9, 0, 0, 0, 0, 51, -3, 56, 61,
247 0, 0, 0, 0, 67, 72, 0, 0, 0, 0,
248 0, 0, 0, 0, 0, 0, 0, 78, 83, 0,
249 0, 0,
250 };
251 #if YYBTYACC
252 static const YYINT varsyntax_calc1_cindex[] = { 0,
253 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
254 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
255 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
256 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
257 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
258 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
259 0, 0,
260 };
261 #endif
262 static const YYINT varsyntax_calc1_gindex[] = { 0,
263 4, 124, 0,
264 };
265 #define YYTABLESIZE 225
266 static const YYINT varsyntax_calc1_table[] = { 6,
267 16, 10, 6, 8, 5, 30, 20, 5, 15, 17,
268 29, 23, 11, 12, 31, 34, 21, 19, 35, 20,
269 0, 22, 37, 39, 41, 43, 28, 0, 0, 0,
270 21, 16, 49, 50, 55, 22, 0, 20, 57, 20,
271 56, 20, 0, 21, 19, 0, 20, 9, 22, 0,
272 0, 0, 0, 18, 58, 59, 60, 61, 26, 24,
273 10, 25, 0, 27, 0, 11, 53, 51, 0, 52,
274 22, 54, 26, 24, 0, 25, 19, 27, 26, 9,
275 9, 21, 9, 27, 9, 18, 18, 10, 18, 0,
276 18, 10, 11, 10, 10, 10, 11, 0, 11, 11,
277 11, 22, 0, 22, 0, 22, 0, 19, 0, 19,
278 53, 19, 21, 0, 21, 54, 21, 0, 10, 0,
279 10, 0, 10, 11, 0, 11, 0, 11, 16, 18,
280 36, 26, 24, 0, 25, 33, 27, 0, 0, 0,
281 0, 0, 38, 40, 42, 44, 0, 45, 46, 47,
282 48, 34, 53, 51, 0, 52, 0, 54, 62, 53,
283 51, 0, 52, 0, 54, 0, 21, 19, 0, 20,
284 0, 22, 0, 0, 0, 0, 0, 0, 0, 0,
285 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
286 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
287 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
288 0, 0, 0, 0, 0, 1, 2, 3, 4, 13,
289 14, 4, 13, 0, 4,
290 };
291 static const YYINT varsyntax_calc1_check[] = { 40,
292 10, 10, 40, 0, 45, 40, 10, 45, 5, 6,
293 45, 10, 61, 61, 11, 41, 42, 43, 44, 45,
294 -1, 47, 19, 20, 21, 22, 10, -1, -1, -1,
295 42, 41, 29, 30, 10, 47, -1, 41, 35, 43,
296 10, 45, -1, 42, 43, -1, 45, 10, 47, -1,
297 -1, -1, -1, 10, 51, 52, 53, 54, 42, 43,
298 10, 45, -1, 47, -1, 10, 42, 43, -1, 45,
299 10, 47, 42, 43, -1, 45, 10, 47, 42, 42,
300 43, 10, 45, 47, 47, 42, 43, 10, 45, -1,
301 47, 41, 10, 43, 44, 45, 41, -1, 43, 44,
302 45, 41, -1, 43, -1, 45, -1, 41, -1, 43,
303 42, 45, 41, -1, 43, 47, 45, -1, 41, -1,
304 43, -1, 45, 41, -1, 43, -1, 45, 5, 6,
305 41, 42, 43, -1, 45, 12, 47, -1, -1, -1,
306 -1, -1, 19, 20, 21, 22, -1, 24, 25, 26,
307 27, 41, 42, 43, -1, 45, -1, 47, 41, 42,
308 43, -1, 45, -1, 47, -1, 42, 43, -1, 45,
309 -1, 47, -1, -1, -1, -1, -1, -1, -1, -1,
310 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
311 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
312 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
313 -1, -1, -1, -1, -1, 256, 257, 258, 259, 257,
314 258, 259, 257, -1, 259,
315 };
316 #if YYBTYACC
317 static const YYINT varsyntax_calc1_ctable[] = { -1,
318 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
319 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
320 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
321 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
322 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
323 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
324 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
325 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
326 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
327 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
328 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
329 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
330 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
331 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
332 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
333 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
334 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
335 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
336 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
337 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
338 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
339 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
340 -1, -1, -1, -1,
341 };
342 #endif
343 #define YYFINAL 7
344 #ifndef YYDEBUG
345 #define YYDEBUG 0
346 #endif
347 #define YYMAXTOKEN 260
348 #define YYUNDFTOKEN 266
349 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
350 #if YYDEBUG
351 static const char *const varsyntax_calc1_name[] = {
352
353 "$end",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
354 0,0,0,0,0,0,"'('","')'","'*'","'+'","','","'-'",0,"'/'",0,0,0,0,0,0,0,0,0,0,0,0,
355 0,"'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
356 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
357 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
358 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
359 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
360 "error","DREG","VREG","CONST","UMINUS","$accept","line","dexp","vexp","lines",
361 "illegal-symbol",
362 };
363 static const char *const varsyntax_calc1_rule[] = {
364 "$accept : line",
365 "lines :",
366 "lines : lines line",
367 "line : dexp '\\n'",
368 "line : vexp '\\n'",
369 "line : DREG '=' dexp '\\n'",
370 "line : VREG '=' vexp '\\n'",
371 "line : error '\\n'",
372 "dexp : CONST",
373 "dexp : DREG",
374 "dexp : dexp '+' dexp",
375 "dexp : dexp '-' dexp",
376 "dexp : dexp '*' dexp",
377 "dexp : dexp '/' dexp",
378 "dexp : '-' dexp",
379 "dexp : '(' dexp ')'",
380 "vexp : dexp",
381 "vexp : '(' dexp ',' dexp ')'",
382 "vexp : VREG",
383 "vexp : vexp '+' vexp",
384 "vexp : dexp '+' vexp",
385 "vexp : vexp '-' vexp",
386 "vexp : dexp '-' vexp",
387 "vexp : vexp '*' vexp",
388 "vexp : dexp '*' vexp",
389 "vexp : vexp '/' vexp",
390 "vexp : dexp '/' vexp",
391 "vexp : '-' vexp",
392 "vexp : '(' vexp ')'",
393
394 };
395 #endif
396
397 #if YYDEBUG
398 int yydebug;
399 #endif
400
401 int yyerrflag;
402 int yychar;
403 YYSTYPE yyval;
404 YYSTYPE yylval;
405 int yynerrs;
406
407 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
408 YYLTYPE yyloc; /* position returned by actions */
409 YYLTYPE yylloc; /* position from the lexer */
410 #endif
411
412 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
413 #ifndef YYLLOC_DEFAULT
414 #define YYLLOC_DEFAULT(loc, rhs, n) \
415 do \
416 { \
417 if (n == 0) \
418 { \
419 (loc).first_line = YYRHSLOC(rhs, 0).last_line; \
420 (loc).first_column = YYRHSLOC(rhs, 0).last_column; \
421 (loc).last_line = YYRHSLOC(rhs, 0).last_line; \
422 (loc).last_column = YYRHSLOC(rhs, 0).last_column; \
423 } \
424 else \
425 { \
426 (loc).first_line = YYRHSLOC(rhs, 1).first_line; \
427 (loc).first_column = YYRHSLOC(rhs, 1).first_column; \
428 (loc).last_line = YYRHSLOC(rhs, n).last_line; \
429 (loc).last_column = YYRHSLOC(rhs, n).last_column; \
430 } \
431 } while (0)
432 #endif /* YYLLOC_DEFAULT */
433 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
434 #if YYBTYACC
435
436 #ifndef YYLVQUEUEGROWTH
437 #define YYLVQUEUEGROWTH 32
438 #endif
439 #endif /* YYBTYACC */
440
441 /* define the initial stack-sizes */
442 #ifdef YYSTACKSIZE
443 #undef YYMAXDEPTH
444 #define YYMAXDEPTH YYSTACKSIZE
445 #else
446 #ifdef YYMAXDEPTH
447 #define YYSTACKSIZE YYMAXDEPTH
448 #else
449 #define YYSTACKSIZE 10000
450 #define YYMAXDEPTH 10000
451 #endif
452 #endif
453
454 #ifndef YYINITSTACKSIZE
455 #define YYINITSTACKSIZE 200
456 #endif
457
458 typedef struct {
459 unsigned stacksize;
460 YYINT *s_base;
461 YYINT *s_mark;
462 YYINT *s_last;
463 YYSTYPE *l_base;
464 YYSTYPE *l_mark;
465 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
466 YYLTYPE *p_base;
467 YYLTYPE *p_mark;
468 #endif
469 } YYSTACKDATA;
470 #if YYBTYACC
471
472 struct YYParseState_s
473 {
474 struct YYParseState_s *save; /* Previously saved parser state */
475 YYSTACKDATA yystack; /* saved parser stack */
476 int state; /* saved parser state */
477 int errflag; /* saved error recovery status */
478 int lexeme; /* saved index of the conflict lexeme in the lexical queue */
479 YYINT ctry; /* saved index in yyctable[] for this conflict */
480 };
481 typedef struct YYParseState_s YYParseState;
482 #endif /* YYBTYACC */
483 /* variables for the parser stack */
484 static YYSTACKDATA yystack;
485 #if YYBTYACC
486
487 /* Current parser state */
488 static YYParseState *yyps = 0;
489
490 /* yypath != NULL: do the full parse, starting at *yypath parser state. */
491 static YYParseState *yypath = 0;
492
493 /* Base of the lexical value queue */
494 static YYSTYPE *yylvals = 0;
495
496 /* Current position at lexical value queue */
497 static YYSTYPE *yylvp = 0;
498
499 /* End position of lexical value queue */
500 static YYSTYPE *yylve = 0;
501
502 /* The last allocated position at the lexical value queue */
503 static YYSTYPE *yylvlim = 0;
504
505 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
506 /* Base of the lexical position queue */
507 static YYLTYPE *yylpsns = 0;
508
509 /* Current position at lexical position queue */
510 static YYLTYPE *yylpp = 0;
511
512 /* End position of lexical position queue */
513 static YYLTYPE *yylpe = 0;
514
515 /* The last allocated position at the lexical position queue */
516 static YYLTYPE *yylplim = 0;
517 #endif
518
519 /* Current position at lexical token queue */
520 static YYINT *yylexp = 0;
521
522 static YYINT *yylexemes = 0;
523 #endif /* YYBTYACC */
524 #line 178 "varsyntax_calc1.y"
525 /* beginning of subroutines section */
526
527 #define BSZ 50 /* buffer size for floating point numbers */
528
529 /* lexical analysis */
530
531 static void
yyerror(const char * s)532 yyerror(const char *s)
533 {
534 fprintf(stderr, "%s\n", s);
535 }
536
537 int
yylex(void)538 yylex(void)
539 {
540 int c;
541
542 while ((c = getchar()) == ' ')
543 { /* skip over blanks */
544 }
545
546 if (isupper(c))
547 {
548 yylval.ival = c - 'A';
549 return (VREG);
550 }
551 if (islower(c))
552 {
553 yylval.ival = c - 'a';
554 return (DREG);
555 }
556
557 if (isdigit(c) || c == '.')
558 {
559 /* gobble up digits, points, exponents */
560 char buf[BSZ + 1], *cp = buf;
561 int dot = 0, expr = 0;
562
563 for (; (cp - buf) < BSZ; ++cp, c = getchar())
564 {
565
566 *cp = (char) c;
567 if (isdigit(c))
568 continue;
569 if (c == '.')
570 {
571 if (dot++ || expr)
572 return ('.'); /* will cause syntax error */
573 continue;
574 }
575
576 if (c == 'e')
577 {
578 if (expr++)
579 return ('e'); /* will cause syntax error */
580 continue;
581 }
582
583 /* end of number */
584 break;
585 }
586 *cp = '\0';
587
588 if ((cp - buf) >= BSZ)
589 printf("constant too long: truncated\n");
590 else
591 ungetc(c, stdin); /* push back last char read */
592 yylval.dval = atof(buf);
593 return (CONST);
594 }
595 return (c);
596 }
597
598 static INTERVAL
hilo(double a,double b,double c,double d)599 hilo(double a, double b, double c, double d)
600 {
601 /* returns the smallest interval containing a, b, c, and d */
602 /* used by *, / routines */
603 INTERVAL v;
604
605 if (a > b)
606 {
607 v.hi = a;
608 v.lo = b;
609 }
610 else
611 {
612 v.hi = b;
613 v.lo = a;
614 }
615
616 if (c > d)
617 {
618 if (c > v.hi)
619 v.hi = c;
620 if (d < v.lo)
621 v.lo = d;
622 }
623 else
624 {
625 if (d > v.hi)
626 v.hi = d;
627 if (c < v.lo)
628 v.lo = c;
629 }
630 return (v);
631 }
632
633 INTERVAL
vmul(double a,double b,INTERVAL v)634 vmul(double a, double b, INTERVAL v)
635 {
636 return (hilo(a * v.hi, a * v.lo, b * v.hi, b * v.lo));
637 }
638
639 int
dcheck(INTERVAL v)640 dcheck(INTERVAL v)
641 {
642 if (v.hi >= 0. && v.lo <= 0.)
643 {
644 printf("divisor interval contains 0.\n");
645 return (1);
646 }
647 return (0);
648 }
649
650 INTERVAL
vdiv(double a,double b,INTERVAL v)651 vdiv(double a, double b, INTERVAL v)
652 {
653 return (hilo(a / v.hi, a / v.lo, b / v.hi, b / v.lo));
654 }
655 #line 656 "varsyntax_calc1.tab.c"
656
657 /* For use in generated program */
658 #define yydepth (int)(yystack.s_mark - yystack.s_base)
659 #if YYBTYACC
660 #define yytrial (yyps->save)
661 #endif /* YYBTYACC */
662
663 #if YYDEBUG
664 #include <stdio.h> /* needed for printf */
665 #endif
666
667 #include <stdlib.h> /* needed for malloc, etc */
668 #include <string.h> /* needed for memset */
669
670 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
yygrowstack(YYSTACKDATA * data)671 static int yygrowstack(YYSTACKDATA *data)
672 {
673 int i;
674 unsigned newsize;
675 YYINT *newss;
676 YYSTYPE *newvs;
677 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
678 YYLTYPE *newps;
679 #endif
680
681 if ((newsize = data->stacksize) == 0)
682 newsize = YYINITSTACKSIZE;
683 else if (newsize >= YYMAXDEPTH)
684 return YYENOMEM;
685 else if ((newsize *= 2) > YYMAXDEPTH)
686 newsize = YYMAXDEPTH;
687
688 i = (int) (data->s_mark - data->s_base);
689 newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
690 if (newss == NULL)
691 return YYENOMEM;
692
693 data->s_base = newss;
694 data->s_mark = newss + i;
695
696 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
697 if (newvs == NULL)
698 return YYENOMEM;
699
700 data->l_base = newvs;
701 data->l_mark = newvs + i;
702
703 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
704 newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
705 if (newps == NULL)
706 return YYENOMEM;
707
708 data->p_base = newps;
709 data->p_mark = newps + i;
710 #endif
711
712 data->stacksize = newsize;
713 data->s_last = data->s_base + newsize - 1;
714
715 #if YYDEBUG
716 if (yydebug)
717 fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
718 #endif
719 return 0;
720 }
721
722 #if YYPURE || defined(YY_NO_LEAKS)
yyfreestack(YYSTACKDATA * data)723 static void yyfreestack(YYSTACKDATA *data)
724 {
725 free(data->s_base);
726 free(data->l_base);
727 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
728 free(data->p_base);
729 #endif
730 memset(data, 0, sizeof(*data));
731 }
732 #else
733 #define yyfreestack(data) /* nothing */
734 #endif /* YYPURE || defined(YY_NO_LEAKS) */
735 #if YYBTYACC
736
737 static YYParseState *
yyNewState(unsigned size)738 yyNewState(unsigned size)
739 {
740 YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
741 if (p == NULL) return NULL;
742
743 p->yystack.stacksize = size;
744 if (size == 0)
745 {
746 p->yystack.s_base = NULL;
747 p->yystack.l_base = NULL;
748 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
749 p->yystack.p_base = NULL;
750 #endif
751 return p;
752 }
753 p->yystack.s_base = (YYINT *) malloc(size * sizeof(YYINT));
754 if (p->yystack.s_base == NULL) return NULL;
755 p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
756 if (p->yystack.l_base == NULL) return NULL;
757 memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
758 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
759 p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
760 if (p->yystack.p_base == NULL) return NULL;
761 memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
762 #endif
763
764 return p;
765 }
766
767 static void
yyFreeState(YYParseState * p)768 yyFreeState(YYParseState *p)
769 {
770 yyfreestack(&p->yystack);
771 free(p);
772 }
773 #endif /* YYBTYACC */
774
775 #define YYABORT goto yyabort
776 #define YYREJECT goto yyabort
777 #define YYACCEPT goto yyaccept
778 #define YYERROR goto yyerrlab
779 #if YYBTYACC
780 #define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
781 #define YYVALID_NESTED do { if (yyps->save && \
782 yyps->save->save == 0) goto yyvalid; } while(0)
783 #endif /* YYBTYACC */
784
785 int
YYPARSE_DECL()786 YYPARSE_DECL()
787 {
788 int yym, yyn, yystate, yyresult;
789 #if YYBTYACC
790 int yynewerrflag;
791 YYParseState *yyerrctx = NULL;
792 #endif /* YYBTYACC */
793 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
794 YYLTYPE yyerror_loc_range[3]; /* position of error start/end (0 unused) */
795 #endif
796 #if YYDEBUG
797 const char *yys;
798
799 if ((yys = getenv("YYDEBUG")) != NULL)
800 {
801 yyn = *yys;
802 if (yyn >= '0' && yyn <= '9')
803 yydebug = yyn - '0';
804 }
805 if (yydebug)
806 fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
807 #endif
808 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
809 memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
810 #endif
811
812 #if YYBTYACC
813 yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
814 yyps->save = 0;
815 #endif /* YYBTYACC */
816 yym = 0;
817 /* yyn is set below */
818 yynerrs = 0;
819 yyerrflag = 0;
820 yychar = YYEMPTY;
821 yystate = 0;
822
823 #if YYPURE
824 memset(&yystack, 0, sizeof(yystack));
825 #endif
826
827 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
828 yystack.s_mark = yystack.s_base;
829 yystack.l_mark = yystack.l_base;
830 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
831 yystack.p_mark = yystack.p_base;
832 #endif
833 yystate = 0;
834 *yystack.s_mark = 0;
835
836 yyloop:
837 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
838 if (yychar < 0)
839 {
840 #if YYBTYACC
841 do {
842 if (yylvp < yylve)
843 {
844 /* we're currently re-reading tokens */
845 yylval = *yylvp++;
846 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
847 yylloc = *yylpp++;
848 #endif
849 yychar = *yylexp++;
850 break;
851 }
852 if (yyps->save)
853 {
854 /* in trial mode; save scanner results for future parse attempts */
855 if (yylvp == yylvlim)
856 { /* Enlarge lexical value queue */
857 size_t p = (size_t) (yylvp - yylvals);
858 size_t s = (size_t) (yylvlim - yylvals);
859
860 s += YYLVQUEUEGROWTH;
861 if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
862 if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
863 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
864 if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
865 #endif
866 yylvp = yylve = yylvals + p;
867 yylvlim = yylvals + s;
868 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
869 yylpp = yylpe = yylpsns + p;
870 yylplim = yylpsns + s;
871 #endif
872 yylexp = yylexemes + p;
873 }
874 *yylexp = (YYINT) YYLEX;
875 *yylvp++ = yylval;
876 yylve++;
877 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
878 *yylpp++ = yylloc;
879 yylpe++;
880 #endif
881 yychar = *yylexp++;
882 break;
883 }
884 /* normal operation, no conflict encountered */
885 #endif /* YYBTYACC */
886 yychar = YYLEX;
887 #if YYBTYACC
888 } while (0);
889 #endif /* YYBTYACC */
890 if (yychar < 0) yychar = YYEOF;
891 #if YYDEBUG
892 if (yydebug)
893 {
894 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
895 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
896 YYDEBUGSTR, yydepth, yystate, yychar, yys);
897 #ifdef YYSTYPE_TOSTRING
898 #if YYBTYACC
899 if (!yytrial)
900 #endif /* YYBTYACC */
901 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
902 #endif
903 fputc('\n', stderr);
904 }
905 #endif
906 }
907 #if YYBTYACC
908
909 /* Do we have a conflict? */
910 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
911 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
912 {
913 YYINT ctry;
914
915 if (yypath)
916 {
917 YYParseState *save;
918 #if YYDEBUG
919 if (yydebug)
920 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
921 YYDEBUGSTR, yydepth, yystate);
922 #endif
923 /* Switch to the next conflict context */
924 save = yypath;
925 yypath = save->save;
926 save->save = NULL;
927 ctry = save->ctry;
928 if (save->state != yystate) YYABORT;
929 yyFreeState(save);
930
931 }
932 else
933 {
934
935 /* Unresolved conflict - start/continue trial parse */
936 YYParseState *save;
937 #if YYDEBUG
938 if (yydebug)
939 {
940 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
941 if (yyps->save)
942 fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
943 else
944 fputs("Starting trial parse.\n", stderr);
945 }
946 #endif
947 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
948 if (save == NULL) goto yyenomem;
949 save->save = yyps->save;
950 save->state = yystate;
951 save->errflag = yyerrflag;
952 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
953 memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
954 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
955 memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
956 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
957 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
958 memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
959 #endif
960 ctry = yytable[yyn];
961 if (yyctable[ctry] == -1)
962 {
963 #if YYDEBUG
964 if (yydebug && yychar >= YYEOF)
965 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
966 #endif
967 ctry++;
968 }
969 save->ctry = ctry;
970 if (yyps->save == NULL)
971 {
972 /* If this is a first conflict in the stack, start saving lexemes */
973 if (!yylexemes)
974 {
975 yylexemes = (YYINT *) malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
976 if (yylexemes == NULL) goto yyenomem;
977 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
978 if (yylvals == NULL) goto yyenomem;
979 yylvlim = yylvals + YYLVQUEUEGROWTH;
980 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
981 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
982 if (yylpsns == NULL) goto yyenomem;
983 yylplim = yylpsns + YYLVQUEUEGROWTH;
984 #endif
985 }
986 if (yylvp == yylve)
987 {
988 yylvp = yylve = yylvals;
989 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
990 yylpp = yylpe = yylpsns;
991 #endif
992 yylexp = yylexemes;
993 if (yychar >= YYEOF)
994 {
995 *yylve++ = yylval;
996 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
997 *yylpe++ = yylloc;
998 #endif
999 *yylexp = (YYINT) yychar;
1000 yychar = YYEMPTY;
1001 }
1002 }
1003 }
1004 if (yychar >= YYEOF)
1005 {
1006 yylvp--;
1007 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1008 yylpp--;
1009 #endif
1010 yylexp--;
1011 yychar = YYEMPTY;
1012 }
1013 save->lexeme = (int) (yylvp - yylvals);
1014 yyps->save = save;
1015 }
1016 if (yytable[yyn] == ctry)
1017 {
1018 #if YYDEBUG
1019 if (yydebug)
1020 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
1021 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
1022 #endif
1023 if (yychar < 0)
1024 {
1025 yylvp++;
1026 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1027 yylpp++;
1028 #endif
1029 yylexp++;
1030 }
1031 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
1032 goto yyoverflow;
1033 yystate = yyctable[ctry];
1034 *++yystack.s_mark = (YYINT) yystate;
1035 *++yystack.l_mark = yylval;
1036 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1037 *++yystack.p_mark = yylloc;
1038 #endif
1039 yychar = YYEMPTY;
1040 if (yyerrflag > 0) --yyerrflag;
1041 goto yyloop;
1042 }
1043 else
1044 {
1045 yyn = yyctable[ctry];
1046 goto yyreduce;
1047 }
1048 } /* End of code dealing with conflicts */
1049 #endif /* YYBTYACC */
1050 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
1051 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
1052 {
1053 #if YYDEBUG
1054 if (yydebug)
1055 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
1056 YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
1057 #endif
1058 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1059 yystate = yytable[yyn];
1060 *++yystack.s_mark = yytable[yyn];
1061 *++yystack.l_mark = yylval;
1062 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1063 *++yystack.p_mark = yylloc;
1064 #endif
1065 yychar = YYEMPTY;
1066 if (yyerrflag > 0) --yyerrflag;
1067 goto yyloop;
1068 }
1069 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
1070 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
1071 {
1072 yyn = yytable[yyn];
1073 goto yyreduce;
1074 }
1075 if (yyerrflag != 0) goto yyinrecovery;
1076 #if YYBTYACC
1077
1078 yynewerrflag = 1;
1079 goto yyerrhandler;
1080 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
1081
1082 yyerrlab:
1083 /* explicit YYERROR from an action -- pop the rhs of the rule reduced
1084 * before looking for error recovery */
1085 yystack.s_mark -= yym;
1086 yystate = *yystack.s_mark;
1087 yystack.l_mark -= yym;
1088 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1089 yystack.p_mark -= yym;
1090 #endif
1091
1092 yynewerrflag = 0;
1093 yyerrhandler:
1094 while (yyps->save)
1095 {
1096 int ctry;
1097 YYParseState *save = yyps->save;
1098 #if YYDEBUG
1099 if (yydebug)
1100 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
1101 YYDEBUGSTR, yydepth, yystate, yyps->save->state,
1102 (int)(yylvp - yylvals - yyps->save->lexeme));
1103 #endif
1104 /* Memorize most forward-looking error state in case it's really an error. */
1105 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
1106 {
1107 /* Free old saved error context state */
1108 if (yyerrctx) yyFreeState(yyerrctx);
1109 /* Create and fill out new saved error context state */
1110 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
1111 if (yyerrctx == NULL) goto yyenomem;
1112 yyerrctx->save = yyps->save;
1113 yyerrctx->state = yystate;
1114 yyerrctx->errflag = yyerrflag;
1115 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
1116 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1117 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
1118 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1119 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1120 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
1121 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1122 #endif
1123 yyerrctx->lexeme = (int) (yylvp - yylvals);
1124 }
1125 yylvp = yylvals + save->lexeme;
1126 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1127 yylpp = yylpsns + save->lexeme;
1128 #endif
1129 yylexp = yylexemes + save->lexeme;
1130 yychar = YYEMPTY;
1131 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
1132 memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1133 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
1134 memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1135 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1136 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
1137 memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1138 #endif
1139 ctry = ++save->ctry;
1140 yystate = save->state;
1141 /* We tried shift, try reduce now */
1142 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
1143 yyps->save = save->save;
1144 save->save = NULL;
1145 yyFreeState(save);
1146
1147 /* Nothing left on the stack -- error */
1148 if (!yyps->save)
1149 {
1150 #if YYDEBUG
1151 if (yydebug)
1152 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
1153 YYPREFIX, yydepth);
1154 #endif
1155 /* Restore state as it was in the most forward-advanced error */
1156 yylvp = yylvals + yyerrctx->lexeme;
1157 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1158 yylpp = yylpsns + yyerrctx->lexeme;
1159 #endif
1160 yylexp = yylexemes + yyerrctx->lexeme;
1161 yychar = yylexp[-1];
1162 yylval = yylvp[-1];
1163 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1164 yylloc = yylpp[-1];
1165 #endif
1166 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
1167 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1168 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
1169 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1170 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1171 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
1172 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1173 #endif
1174 yystate = yyerrctx->state;
1175 yyFreeState(yyerrctx);
1176 yyerrctx = NULL;
1177 }
1178 yynewerrflag = 1;
1179 }
1180 if (yynewerrflag == 0) goto yyinrecovery;
1181 #endif /* YYBTYACC */
1182
1183 YYERROR_CALL("syntax error");
1184 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1185 yyerror_loc_range[1] = yylloc; /* lookahead position is error start position */
1186 #endif
1187
1188 #if !YYBTYACC
1189 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
1190 yyerrlab:
1191 #endif
1192 ++yynerrs;
1193
1194 yyinrecovery:
1195 if (yyerrflag < 3)
1196 {
1197 yyerrflag = 3;
1198 for (;;)
1199 {
1200 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
1201 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
1202 {
1203 #if YYDEBUG
1204 if (yydebug)
1205 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
1206 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
1207 #endif
1208 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1209 yystate = yytable[yyn];
1210 *++yystack.s_mark = yytable[yyn];
1211 *++yystack.l_mark = yylval;
1212 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1213 /* lookahead position is error end position */
1214 yyerror_loc_range[2] = yylloc;
1215 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
1216 *++yystack.p_mark = yyloc;
1217 #endif
1218 goto yyloop;
1219 }
1220 else
1221 {
1222 #if YYDEBUG
1223 if (yydebug)
1224 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
1225 YYDEBUGSTR, yydepth, *yystack.s_mark);
1226 #endif
1227 if (yystack.s_mark <= yystack.s_base) goto yyabort;
1228 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1229 /* the current TOS position is the error start position */
1230 yyerror_loc_range[1] = *yystack.p_mark;
1231 #endif
1232 #if defined(YYDESTRUCT_CALL)
1233 #if YYBTYACC
1234 if (!yytrial)
1235 #endif /* YYBTYACC */
1236 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1237 YYDESTRUCT_CALL("error: discarding state",
1238 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
1239 #else
1240 YYDESTRUCT_CALL("error: discarding state",
1241 yystos[*yystack.s_mark], yystack.l_mark);
1242 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1243 #endif /* defined(YYDESTRUCT_CALL) */
1244 --yystack.s_mark;
1245 --yystack.l_mark;
1246 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1247 --yystack.p_mark;
1248 #endif
1249 }
1250 }
1251 }
1252 else
1253 {
1254 if (yychar == YYEOF) goto yyabort;
1255 #if YYDEBUG
1256 if (yydebug)
1257 {
1258 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1259 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
1260 YYDEBUGSTR, yydepth, yystate, yychar, yys);
1261 }
1262 #endif
1263 #if defined(YYDESTRUCT_CALL)
1264 #if YYBTYACC
1265 if (!yytrial)
1266 #endif /* YYBTYACC */
1267 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1268 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
1269 #else
1270 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
1271 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1272 #endif /* defined(YYDESTRUCT_CALL) */
1273 yychar = YYEMPTY;
1274 goto yyloop;
1275 }
1276
1277 yyreduce:
1278 yym = yylen[yyn];
1279 #if YYDEBUG
1280 if (yydebug)
1281 {
1282 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
1283 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
1284 #ifdef YYSTYPE_TOSTRING
1285 #if YYBTYACC
1286 if (!yytrial)
1287 #endif /* YYBTYACC */
1288 if (yym > 0)
1289 {
1290 int i;
1291 fputc('<', stderr);
1292 for (i = yym; i > 0; i--)
1293 {
1294 if (i != yym) fputs(", ", stderr);
1295 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
1296 yystack.l_mark[1-i]), stderr);
1297 }
1298 fputc('>', stderr);
1299 }
1300 #endif
1301 fputc('\n', stderr);
1302 }
1303 #endif
1304 if (yym > 0)
1305 yyval = yystack.l_mark[1-yym];
1306 else
1307 memset(&yyval, 0, sizeof yyval);
1308 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1309
1310 /* Perform position reduction */
1311 memset(&yyloc, 0, sizeof(yyloc));
1312 #if YYBTYACC
1313 if (!yytrial)
1314 #endif /* YYBTYACC */
1315 {
1316 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[-yym], yym);
1317 /* just in case YYERROR is invoked within the action, save
1318 the start of the rhs as the error start position */
1319 yyerror_loc_range[1] = yystack.p_mark[1-yym];
1320 }
1321 #endif
1322
1323 switch (yyn)
1324 {
1325 case 3:
1326 #line 59 "varsyntax_calc1.y"
1327 {
1328 (void) printf("%15.8f\n", yystack.l_mark[-1].dval);
1329 }
1330 #line 1331 "varsyntax_calc1.tab.c"
1331 break;
1332 case 4:
1333 #line 63 "varsyntax_calc1.y"
1334 {
1335 (void) printf("(%15.8f, %15.8f)\n", yystack.l_mark[-1].vval.lo, yystack.l_mark[-1].vval.hi);
1336 }
1337 #line 1338 "varsyntax_calc1.tab.c"
1338 break;
1339 case 5:
1340 #line 67 "varsyntax_calc1.y"
1341 {
1342 dreg[yystack.l_mark[-3].ival] = yystack.l_mark[-1].dval;
1343 }
1344 #line 1345 "varsyntax_calc1.tab.c"
1345 break;
1346 case 6:
1347 #line 71 "varsyntax_calc1.y"
1348 {
1349 vreg[yystack.l_mark[-3].ival] = yystack.l_mark[-1].vval;
1350 }
1351 #line 1352 "varsyntax_calc1.tab.c"
1352 break;
1353 case 7:
1354 #line 75 "varsyntax_calc1.y"
1355 {
1356 yyerrok;
1357 }
1358 #line 1359 "varsyntax_calc1.tab.c"
1359 break;
1360 case 9:
1361 #line 82 "varsyntax_calc1.y"
1362 {
1363 yyval.dval = dreg[yystack.l_mark[0].ival]; /* $$ & $1 are sufficient here*/
1364 }
1365 #line 1366 "varsyntax_calc1.tab.c"
1366 break;
1367 case 10:
1368 #line 86 "varsyntax_calc1.y"
1369 {
1370 yyval.dval = yystack.l_mark[-2].dval + yystack.l_mark[0].dval;
1371 }
1372 #line 1373 "varsyntax_calc1.tab.c"
1373 break;
1374 case 11:
1375 #line 90 "varsyntax_calc1.y"
1376 {
1377 yyval.dval = yystack.l_mark[-2].dval - yystack.l_mark[0].dval;
1378 }
1379 #line 1380 "varsyntax_calc1.tab.c"
1380 break;
1381 case 12:
1382 #line 94 "varsyntax_calc1.y"
1383 {
1384 yyval.dval = yystack.l_mark[-2].dval * yystack.l_mark[0].dval;
1385 }
1386 #line 1387 "varsyntax_calc1.tab.c"
1387 break;
1388 case 13:
1389 #line 98 "varsyntax_calc1.y"
1390 {
1391 yyval.dval = yystack.l_mark[-2].dval / yystack.l_mark[0].dval;
1392 }
1393 #line 1394 "varsyntax_calc1.tab.c"
1394 break;
1395 case 14:
1396 #line 102 "varsyntax_calc1.y"
1397 {
1398 yyval.dval = -yystack.l_mark[0].dval;
1399 }
1400 #line 1401 "varsyntax_calc1.tab.c"
1401 break;
1402 case 15:
1403 #line 106 "varsyntax_calc1.y"
1404 {
1405 yyval.dval = yystack.l_mark[-1].dval;
1406 }
1407 #line 1408 "varsyntax_calc1.tab.c"
1408 break;
1409 case 16:
1410 #line 112 "varsyntax_calc1.y"
1411 {
1412 yyval.vval.hi = yyval.vval.lo = yystack.l_mark[0].dval;
1413 }
1414 #line 1415 "varsyntax_calc1.tab.c"
1415 break;
1416 case 17:
1417 #line 116 "varsyntax_calc1.y"
1418 {
1419 yyval.vval.lo = yystack.l_mark[-3].dval;
1420 yyval.vval.hi = yystack.l_mark[-1].dval;
1421 if ( yyval.vval.lo > yyval.vval.hi )
1422 {
1423 (void) printf("interval out of order\n");
1424 YYERROR;
1425 }
1426 }
1427 #line 1428 "varsyntax_calc1.tab.c"
1428 break;
1429 case 18:
1430 #line 126 "varsyntax_calc1.y"
1431 {
1432 yyval.vval = vreg[yystack.l_mark[0].ival];
1433 }
1434 #line 1435 "varsyntax_calc1.tab.c"
1435 break;
1436 case 19:
1437 #line 130 "varsyntax_calc1.y"
1438 {
1439 yyval.vval.hi = yystack.l_mark[-2].vval.hi + yystack.l_mark[0].vval.hi;
1440 yyval.vval.lo = yystack.l_mark[-2].vval.lo + yystack.l_mark[0].vval.lo;
1441 }
1442 #line 1443 "varsyntax_calc1.tab.c"
1443 break;
1444 case 20:
1445 #line 135 "varsyntax_calc1.y"
1446 {
1447 yyval.vval.hi = yystack.l_mark[-2].dval + yystack.l_mark[0].vval.hi;
1448 yyval.vval.lo = yystack.l_mark[-2].dval + yystack.l_mark[0].vval.lo;
1449 }
1450 #line 1451 "varsyntax_calc1.tab.c"
1451 break;
1452 case 21:
1453 #line 140 "varsyntax_calc1.y"
1454 {
1455 yyval.vval.hi = yystack.l_mark[-2].vval.hi - yystack.l_mark[0].vval.lo;
1456 yyval.vval.lo = yystack.l_mark[-2].vval.lo - yystack.l_mark[0].vval.hi;
1457 }
1458 #line 1459 "varsyntax_calc1.tab.c"
1459 break;
1460 case 22:
1461 #line 145 "varsyntax_calc1.y"
1462 {
1463 yyval.vval.hi = yystack.l_mark[-2].dval - yystack.l_mark[0].vval.lo;
1464 yyval.vval.lo = yystack.l_mark[-2].dval - yystack.l_mark[0].vval.hi;
1465 }
1466 #line 1467 "varsyntax_calc1.tab.c"
1467 break;
1468 case 23:
1469 #line 150 "varsyntax_calc1.y"
1470 {
1471 yyval.vval = vmul( yystack.l_mark[-2].vval.lo, yystack.l_mark[-2].vval.hi, yystack.l_mark[0].vval );
1472 }
1473 #line 1474 "varsyntax_calc1.tab.c"
1474 break;
1475 case 24:
1476 #line 154 "varsyntax_calc1.y"
1477 {
1478 yyval.vval = vmul (yystack.l_mark[-2].dval, yystack.l_mark[-2].dval, yystack.l_mark[0].vval );
1479 }
1480 #line 1481 "varsyntax_calc1.tab.c"
1481 break;
1482 case 25:
1483 #line 158 "varsyntax_calc1.y"
1484 {
1485 if (dcheck(yystack.l_mark[0].vval)) YYERROR;
1486 yyval.vval = vdiv ( yystack.l_mark[-2].vval.lo, yystack.l_mark[-2].vval.hi, yystack.l_mark[0].vval );
1487 }
1488 #line 1489 "varsyntax_calc1.tab.c"
1489 break;
1490 case 26:
1491 #line 163 "varsyntax_calc1.y"
1492 {
1493 if (dcheck ( yystack.l_mark[0].vval )) YYERROR;
1494 yyval.vval = vdiv (yystack.l_mark[-2].dval, yystack.l_mark[-2].dval, yystack.l_mark[0].vval );
1495 }
1496 #line 1497 "varsyntax_calc1.tab.c"
1497 break;
1498 case 27:
1499 #line 168 "varsyntax_calc1.y"
1500 {
1501 yyval.vval.hi = -yystack.l_mark[0].vval.lo;
1502 yyval.vval.lo = -yystack.l_mark[0].vval.hi;
1503 }
1504 #line 1505 "varsyntax_calc1.tab.c"
1505 break;
1506 case 28:
1507 #line 173 "varsyntax_calc1.y"
1508 {
1509 yyval.vval = yystack.l_mark[-1].vval;
1510 }
1511 #line 1512 "varsyntax_calc1.tab.c"
1512 break;
1513 #line 1514 "varsyntax_calc1.tab.c"
1514 default:
1515 break;
1516 }
1517 yystack.s_mark -= yym;
1518 yystate = *yystack.s_mark;
1519 yystack.l_mark -= yym;
1520 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1521 yystack.p_mark -= yym;
1522 #endif
1523 yym = yylhs[yyn];
1524 if (yystate == 0 && yym == 0)
1525 {
1526 #if YYDEBUG
1527 if (yydebug)
1528 {
1529 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1530 #ifdef YYSTYPE_TOSTRING
1531 #if YYBTYACC
1532 if (!yytrial)
1533 #endif /* YYBTYACC */
1534 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
1535 #endif
1536 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
1537 }
1538 #endif
1539 yystate = YYFINAL;
1540 *++yystack.s_mark = YYFINAL;
1541 *++yystack.l_mark = yyval;
1542 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1543 *++yystack.p_mark = yyloc;
1544 #endif
1545 if (yychar < 0)
1546 {
1547 #if YYBTYACC
1548 do {
1549 if (yylvp < yylve)
1550 {
1551 /* we're currently re-reading tokens */
1552 yylval = *yylvp++;
1553 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1554 yylloc = *yylpp++;
1555 #endif
1556 yychar = *yylexp++;
1557 break;
1558 }
1559 if (yyps->save)
1560 {
1561 /* in trial mode; save scanner results for future parse attempts */
1562 if (yylvp == yylvlim)
1563 { /* Enlarge lexical value queue */
1564 size_t p = (size_t) (yylvp - yylvals);
1565 size_t s = (size_t) (yylvlim - yylvals);
1566
1567 s += YYLVQUEUEGROWTH;
1568 if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL)
1569 goto yyenomem;
1570 if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
1571 goto yyenomem;
1572 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1573 if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
1574 goto yyenomem;
1575 #endif
1576 yylvp = yylve = yylvals + p;
1577 yylvlim = yylvals + s;
1578 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1579 yylpp = yylpe = yylpsns + p;
1580 yylplim = yylpsns + s;
1581 #endif
1582 yylexp = yylexemes + p;
1583 }
1584 *yylexp = (YYINT) YYLEX;
1585 *yylvp++ = yylval;
1586 yylve++;
1587 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1588 *yylpp++ = yylloc;
1589 yylpe++;
1590 #endif
1591 yychar = *yylexp++;
1592 break;
1593 }
1594 /* normal operation, no conflict encountered */
1595 #endif /* YYBTYACC */
1596 yychar = YYLEX;
1597 #if YYBTYACC
1598 } while (0);
1599 #endif /* YYBTYACC */
1600 if (yychar < 0) yychar = YYEOF;
1601 #if YYDEBUG
1602 if (yydebug)
1603 {
1604 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1605 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)\n",
1606 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
1607 }
1608 #endif
1609 }
1610 if (yychar == YYEOF) goto yyaccept;
1611 goto yyloop;
1612 }
1613 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1614 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1615 yystate = yytable[yyn];
1616 else
1617 yystate = yydgoto[yym];
1618 #if YYDEBUG
1619 if (yydebug)
1620 {
1621 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1622 #ifdef YYSTYPE_TOSTRING
1623 #if YYBTYACC
1624 if (!yytrial)
1625 #endif /* YYBTYACC */
1626 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
1627 #endif
1628 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
1629 }
1630 #endif
1631 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1632 *++yystack.s_mark = (YYINT) yystate;
1633 *++yystack.l_mark = yyval;
1634 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1635 *++yystack.p_mark = yyloc;
1636 #endif
1637 goto yyloop;
1638 #if YYBTYACC
1639
1640 /* Reduction declares that this path is valid. Set yypath and do a full parse */
1641 yyvalid:
1642 if (yypath) YYABORT;
1643 while (yyps->save)
1644 {
1645 YYParseState *save = yyps->save;
1646 yyps->save = save->save;
1647 save->save = yypath;
1648 yypath = save;
1649 }
1650 #if YYDEBUG
1651 if (yydebug)
1652 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
1653 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
1654 #endif
1655 if (yyerrctx)
1656 {
1657 yyFreeState(yyerrctx);
1658 yyerrctx = NULL;
1659 }
1660 yylvp = yylvals + yypath->lexeme;
1661 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1662 yylpp = yylpsns + yypath->lexeme;
1663 #endif
1664 yylexp = yylexemes + yypath->lexeme;
1665 yychar = YYEMPTY;
1666 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
1667 memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1668 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
1669 memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1670 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1671 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
1672 memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1673 #endif
1674 yystate = yypath->state;
1675 goto yyloop;
1676 #endif /* YYBTYACC */
1677
1678 yyoverflow:
1679 YYERROR_CALL("yacc stack overflow");
1680 #if YYBTYACC
1681 goto yyabort_nomem;
1682 yyenomem:
1683 YYERROR_CALL("memory exhausted");
1684 yyabort_nomem:
1685 #endif /* YYBTYACC */
1686 yyresult = 2;
1687 goto yyreturn;
1688
1689 yyabort:
1690 yyresult = 1;
1691 goto yyreturn;
1692
1693 yyaccept:
1694 #if YYBTYACC
1695 if (yyps->save) goto yyvalid;
1696 #endif /* YYBTYACC */
1697 yyresult = 0;
1698
1699 yyreturn:
1700 #if defined(YYDESTRUCT_CALL)
1701 if (yychar != YYEOF && yychar != YYEMPTY)
1702 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1703 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
1704 #else
1705 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
1706 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1707
1708 {
1709 YYSTYPE *pv;
1710 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1711 YYLTYPE *pp;
1712
1713 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
1714 YYDESTRUCT_CALL("cleanup: discarding state",
1715 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
1716 #else
1717 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
1718 YYDESTRUCT_CALL("cleanup: discarding state",
1719 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
1720 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1721 }
1722 #endif /* defined(YYDESTRUCT_CALL) */
1723
1724 #if YYBTYACC
1725 if (yyerrctx)
1726 {
1727 yyFreeState(yyerrctx);
1728 yyerrctx = NULL;
1729 }
1730 while (yyps)
1731 {
1732 YYParseState *save = yyps;
1733 yyps = save->save;
1734 save->save = NULL;
1735 yyFreeState(save);
1736 }
1737 while (yypath)
1738 {
1739 YYParseState *save = yypath;
1740 yypath = save->save;
1741 save->save = NULL;
1742 yyFreeState(save);
1743 }
1744 #endif /* YYBTYACC */
1745 yyfreestack(&yystack);
1746 return (yyresult);
1747 }
1748