xref: /freebsd/contrib/byacc/test/yacc/varsyntax_calc1.tab.c (revision 62cfcf62f627e5093fb37026a6d8c98e4d2ef04c)
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 1
7 #define YYMINOR 9
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 
18 #ifndef yyparse
19 #define yyparse    varsyntax_calc1_parse
20 #endif /* yyparse */
21 
22 #ifndef yylex
23 #define yylex      varsyntax_calc1_lex
24 #endif /* yylex */
25 
26 #ifndef yyerror
27 #define yyerror    varsyntax_calc1_error
28 #endif /* yyerror */
29 
30 #ifndef yychar
31 #define yychar     varsyntax_calc1_char
32 #endif /* yychar */
33 
34 #ifndef yyval
35 #define yyval      varsyntax_calc1_val
36 #endif /* yyval */
37 
38 #ifndef yylval
39 #define yylval     varsyntax_calc1_lval
40 #endif /* yylval */
41 
42 #ifndef yydebug
43 #define yydebug    varsyntax_calc1_debug
44 #endif /* yydebug */
45 
46 #ifndef yynerrs
47 #define yynerrs    varsyntax_calc1_nerrs
48 #endif /* yynerrs */
49 
50 #ifndef yyerrflag
51 #define yyerrflag  varsyntax_calc1_errflag
52 #endif /* yyerrflag */
53 
54 #ifndef yylhs
55 #define yylhs      varsyntax_calc1_lhs
56 #endif /* yylhs */
57 
58 #ifndef yylen
59 #define yylen      varsyntax_calc1_len
60 #endif /* yylen */
61 
62 #ifndef yydefred
63 #define yydefred   varsyntax_calc1_defred
64 #endif /* yydefred */
65 
66 #ifndef yydgoto
67 #define yydgoto    varsyntax_calc1_dgoto
68 #endif /* yydgoto */
69 
70 #ifndef yysindex
71 #define yysindex   varsyntax_calc1_sindex
72 #endif /* yysindex */
73 
74 #ifndef yyrindex
75 #define yyrindex   varsyntax_calc1_rindex
76 #endif /* yyrindex */
77 
78 #ifndef yygindex
79 #define yygindex   varsyntax_calc1_gindex
80 #endif /* yygindex */
81 
82 #ifndef yytable
83 #define yytable    varsyntax_calc1_table
84 #endif /* yytable */
85 
86 #ifndef yycheck
87 #define yycheck    varsyntax_calc1_check
88 #endif /* yycheck */
89 
90 #ifndef yyname
91 #define yyname     varsyntax_calc1_name
92 #endif /* yyname */
93 
94 #ifndef yyrule
95 #define yyrule     varsyntax_calc1_rule
96 #endif /* yyrule */
97 #define YYPREFIX "varsyntax_calc1_"
98 
99 #define YYPURE 0
100 
101 #line 3 "varsyntax_calc1.y"
102 
103 /* http://dinosaur.compilertools.net/yacc/index.html * /*/
104 
105 #include <stdlib.h>
106 #include <stdio.h>
107 #include <ctype.h>
108 #include <math.h>
109 
110 typedef struct interval
111 {
112     double lo, hi;
113 }
114 INTERVAL;
115 
116 INTERVAL vmul(double, double, INTERVAL);
117 INTERVAL vdiv(double, double, INTERVAL);
118 
119 extern int yylex(void);
120 static void yyerror(const char *s);
121 
122 int dcheck(INTERVAL);
123 
124 double dreg[26];
125 INTERVAL vreg[26];
126 
127 #ifdef YYSTYPE
128 #undef  YYSTYPE_IS_DECLARED
129 #define YYSTYPE_IS_DECLARED 1
130 #endif
131 #ifndef YYSTYPE_IS_DECLARED
132 #define YYSTYPE_IS_DECLARED 1
133 #line 32 "varsyntax_calc1.y"
134 typedef union
135 {
136 	int ival;	/* dreg & vreg array index values*/
137 	double dval;	/* floating point values*/
138 	INTERVAL vval;	/* interval values*/
139 } YYSTYPE;
140 #endif /* !YYSTYPE_IS_DECLARED */
141 #line 142 "varsyntax_calc1.tab.c"
142 
143 /* compatibility with bison */
144 #ifdef YYPARSE_PARAM
145 /* compatibility with FreeBSD */
146 # ifdef YYPARSE_PARAM_TYPE
147 #  define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
148 # else
149 #  define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
150 # endif
151 #else
152 # define YYPARSE_DECL() yyparse(void)
153 #endif
154 
155 /* Parameters sent to lex. */
156 #ifdef YYLEX_PARAM
157 # define YYLEX_DECL() yylex(void *YYLEX_PARAM)
158 # define YYLEX yylex(YYLEX_PARAM)
159 #else
160 # define YYLEX_DECL() yylex(void)
161 # define YYLEX yylex()
162 #endif
163 
164 /* Parameters sent to yyerror. */
165 #ifndef YYERROR_DECL
166 #define YYERROR_DECL() yyerror(const char *s)
167 #endif
168 #ifndef YYERROR_CALL
169 #define YYERROR_CALL(msg) yyerror(msg)
170 #endif
171 
172 extern int YYPARSE_DECL();
173 
174 #define DREG 257
175 #define VREG 258
176 #define CONST 259
177 #define UMINUS 260
178 #define YYERRCODE 256
179 typedef int YYINT;
180 static const YYINT varsyntax_calc1_lhs[] = {             -1,
181     3,    3,    0,    0,    0,    0,    0,    1,    1,    1,
182     1,    1,    1,    1,    1,    2,    2,    2,    2,    2,
183     2,    2,    2,    2,    2,    2,    2,    2,
184 };
185 static const YYINT varsyntax_calc1_len[] = {              2,
186     0,    2,    2,    2,    4,    4,    2,    1,    1,    3,
187     3,    3,    3,    2,    3,    1,    5,    1,    3,    3,
188     3,    3,    3,    3,    3,    3,    2,    3,
189 };
190 static const YYINT varsyntax_calc1_defred[] = {           0,
191     0,    0,    0,    8,    0,    0,    0,    0,    0,    7,
192     0,    0,    9,   18,   14,   27,    0,    0,    0,    0,
193     0,    0,    3,    0,    0,    0,    0,    4,    0,    0,
194     0,    0,    0,   15,    0,   28,    0,    0,    0,    0,
195    12,   24,   13,   26,    0,    0,   23,   25,   14,    0,
196     0,    0,    0,    0,    5,    6,    0,    0,    0,   12,
197    13,   17,
198 };
199 static const YYINT varsyntax_calc1_dgoto[] = {            7,
200    32,    9,    0,
201 };
202 static const YYINT varsyntax_calc1_sindex[] = {         -40,
203    -8,  -48,  -47,    0,  -37,  -37,    0,    2,   17,    0,
204   -34,  -37,    0,    0,    0,    0,  -25,   90,  -37,  -37,
205   -37,  -37,    0,  -37,  -37,  -37,  -37,    0,  -34,  -34,
206    25,  125,   31,    0,  -34,    0,  -11,   37,  -11,   37,
207     0,    0,    0,    0,   37,   37,    0,    0,    0,  111,
208   -34,  -34,  -34,  -34,    0,    0,  118,   69,   69,    0,
209     0,    0,
210 };
211 static const YYINT varsyntax_calc1_rindex[] = {           0,
212     0,   38,   44,    0,    0,    0,    0,    0,    0,    0,
213     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
214     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
215     0,   -9,    0,    0,    0,    0,   51,   -3,   56,   61,
216     0,    0,    0,    0,   67,   72,    0,    0,    0,    0,
217     0,    0,    0,    0,    0,    0,    0,   78,   83,    0,
218     0,    0,
219 };
220 static const YYINT varsyntax_calc1_gindex[] = {           0,
221     4,  124,    0,
222 };
223 #define YYTABLESIZE 225
224 static const YYINT varsyntax_calc1_table[] = {            6,
225    16,   10,    6,    8,    5,   30,   20,    5,   15,   17,
226    29,   23,   11,   12,   31,   34,   21,   19,   35,   20,
227     0,   22,   37,   39,   41,   43,   28,    0,    0,    0,
228    21,   16,   49,   50,   55,   22,    0,   20,   57,   20,
229    56,   20,    0,   21,   19,    0,   20,    9,   22,    0,
230     0,    0,    0,   18,   58,   59,   60,   61,   26,   24,
231    10,   25,    0,   27,    0,   11,   53,   51,    0,   52,
232    22,   54,   26,   24,    0,   25,   19,   27,   26,    9,
233     9,   21,    9,   27,    9,   18,   18,   10,   18,    0,
234    18,   10,   11,   10,   10,   10,   11,    0,   11,   11,
235    11,   22,    0,   22,    0,   22,    0,   19,    0,   19,
236    53,   19,   21,    0,   21,   54,   21,    0,   10,    0,
237    10,    0,   10,   11,    0,   11,    0,   11,   16,   18,
238    36,   26,   24,    0,   25,   33,   27,    0,    0,    0,
239     0,    0,   38,   40,   42,   44,    0,   45,   46,   47,
240    48,   34,   53,   51,    0,   52,    0,   54,   62,   53,
241    51,    0,   52,    0,   54,    0,   21,   19,    0,   20,
242     0,   22,    0,    0,    0,    0,    0,    0,    0,    0,
243     0,    0,    0,    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,    0,    0,    0,    0,    1,    2,    3,    4,   13,
247    14,    4,   13,    0,    4,
248 };
249 static const YYINT varsyntax_calc1_check[] = {           40,
250    10,   10,   40,    0,   45,   40,   10,   45,    5,    6,
251    45,   10,   61,   61,   11,   41,   42,   43,   44,   45,
252    -1,   47,   19,   20,   21,   22,   10,   -1,   -1,   -1,
253    42,   41,   29,   30,   10,   47,   -1,   41,   35,   43,
254    10,   45,   -1,   42,   43,   -1,   45,   10,   47,   -1,
255    -1,   -1,   -1,   10,   51,   52,   53,   54,   42,   43,
256    10,   45,   -1,   47,   -1,   10,   42,   43,   -1,   45,
257    10,   47,   42,   43,   -1,   45,   10,   47,   42,   42,
258    43,   10,   45,   47,   47,   42,   43,   10,   45,   -1,
259    47,   41,   10,   43,   44,   45,   41,   -1,   43,   44,
260    45,   41,   -1,   43,   -1,   45,   -1,   41,   -1,   43,
261    42,   45,   41,   -1,   43,   47,   45,   -1,   41,   -1,
262    43,   -1,   45,   41,   -1,   43,   -1,   45,    5,    6,
263    41,   42,   43,   -1,   45,   12,   47,   -1,   -1,   -1,
264    -1,   -1,   19,   20,   21,   22,   -1,   24,   25,   26,
265    27,   41,   42,   43,   -1,   45,   -1,   47,   41,   42,
266    43,   -1,   45,   -1,   47,   -1,   42,   43,   -1,   45,
267    -1,   47,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
268    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
269    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
270    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
271    -1,   -1,   -1,   -1,   -1,  256,  257,  258,  259,  257,
272   258,  259,  257,   -1,  259,
273 };
274 #define YYFINAL 7
275 #ifndef YYDEBUG
276 #define YYDEBUG 0
277 #endif
278 #define YYMAXTOKEN 260
279 #define YYUNDFTOKEN 266
280 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
281 #if YYDEBUG
282 static const char *const varsyntax_calc1_name[] = {
283 
284 "end-of-file",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,
285 0,0,0,0,0,0,0,0,0,"'('","')'","'*'","'+'","','","'-'",0,"'/'",0,0,0,0,0,0,0,0,0,
286 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,
287 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,
288 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,
289 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,
290 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,
291 0,0,"DREG","VREG","CONST","UMINUS",0,0,0,0,0,"illegal-symbol",
292 };
293 static const char *const varsyntax_calc1_rule[] = {
294 "$accept : line",
295 "lines :",
296 "lines : lines line",
297 "line : dexp '\\n'",
298 "line : vexp '\\n'",
299 "line : DREG '=' dexp '\\n'",
300 "line : VREG '=' vexp '\\n'",
301 "line : error '\\n'",
302 "dexp : CONST",
303 "dexp : DREG",
304 "dexp : dexp '+' dexp",
305 "dexp : dexp '-' dexp",
306 "dexp : dexp '*' dexp",
307 "dexp : dexp '/' dexp",
308 "dexp : '-' dexp",
309 "dexp : '(' dexp ')'",
310 "vexp : dexp",
311 "vexp : '(' dexp ',' dexp ')'",
312 "vexp : VREG",
313 "vexp : vexp '+' vexp",
314 "vexp : dexp '+' vexp",
315 "vexp : vexp '-' vexp",
316 "vexp : dexp '-' vexp",
317 "vexp : vexp '*' vexp",
318 "vexp : dexp '*' vexp",
319 "vexp : vexp '/' vexp",
320 "vexp : dexp '/' vexp",
321 "vexp : '-' vexp",
322 "vexp : '(' vexp ')'",
323 
324 };
325 #endif
326 
327 int      yydebug;
328 int      yynerrs;
329 
330 int      yyerrflag;
331 int      yychar;
332 YYSTYPE  yyval;
333 YYSTYPE  yylval;
334 
335 /* define the initial stack-sizes */
336 #ifdef YYSTACKSIZE
337 #undef YYMAXDEPTH
338 #define YYMAXDEPTH  YYSTACKSIZE
339 #else
340 #ifdef YYMAXDEPTH
341 #define YYSTACKSIZE YYMAXDEPTH
342 #else
343 #define YYSTACKSIZE 10000
344 #define YYMAXDEPTH  10000
345 #endif
346 #endif
347 
348 #define YYINITSTACKSIZE 200
349 
350 typedef struct {
351     unsigned stacksize;
352     YYINT    *s_base;
353     YYINT    *s_mark;
354     YYINT    *s_last;
355     YYSTYPE  *l_base;
356     YYSTYPE  *l_mark;
357 } YYSTACKDATA;
358 /* variables for the parser stack */
359 static YYSTACKDATA yystack;
360 #line 178 "varsyntax_calc1.y"
361 	/* beginning of subroutines section */
362 
363 #define BSZ 50			/* buffer size for floating point numbers */
364 
365 	/* lexical analysis */
366 
367 static void
368 yyerror(const char *s)
369 {
370     fprintf(stderr, "%s\n", s);
371 }
372 
373 int
374 yylex(void)
375 {
376     int c;
377 
378     while ((c = getchar()) == ' ')
379     {				/* skip over blanks */
380     }
381 
382     if (isupper(c))
383     {
384 	yylval.ival = c - 'A';
385 	return (VREG);
386     }
387     if (islower(c))
388     {
389 	yylval.ival = c - 'a';
390 	return (DREG);
391     }
392 
393     if (isdigit(c) || c == '.')
394     {
395 	/* gobble up digits, points, exponents */
396 	char buf[BSZ + 1], *cp = buf;
397 	int dot = 0, expr = 0;
398 
399 	for (; (cp - buf) < BSZ; ++cp, c = getchar())
400 	{
401 
402 	    *cp = (char) c;
403 	    if (isdigit(c))
404 		continue;
405 	    if (c == '.')
406 	    {
407 		if (dot++ || expr)
408 		    return ('.');	/* will cause syntax error */
409 		continue;
410 	    }
411 
412 	    if (c == 'e')
413 	    {
414 		if (expr++)
415 		    return ('e');	/*  will  cause  syntax  error  */
416 		continue;
417 	    }
418 
419 	    /*  end  of  number  */
420 	    break;
421 	}
422 	*cp = '\0';
423 
424 	if ((cp - buf) >= BSZ)
425 	    printf("constant  too  long:  truncated\n");
426 	else
427 	    ungetc(c, stdin);	/*  push  back  last  char  read  */
428 	yylval.dval = atof(buf);
429 	return (CONST);
430     }
431     return (c);
432 }
433 
434 static INTERVAL
435 hilo(double a, double b, double c, double d)
436 {
437     /*  returns  the  smallest  interval  containing  a,  b,  c,  and  d  */
438     /*  used  by  *,  /  routines  */
439     INTERVAL v;
440 
441     if (a > b)
442     {
443 	v.hi = a;
444 	v.lo = b;
445     }
446     else
447     {
448 	v.hi = b;
449 	v.lo = a;
450     }
451 
452     if (c > d)
453     {
454 	if (c > v.hi)
455 	    v.hi = c;
456 	if (d < v.lo)
457 	    v.lo = d;
458     }
459     else
460     {
461 	if (d > v.hi)
462 	    v.hi = d;
463 	if (c < v.lo)
464 	    v.lo = c;
465     }
466     return (v);
467 }
468 
469 INTERVAL
470 vmul(double a, double b, INTERVAL v)
471 {
472     return (hilo(a * v.hi, a * v.lo, b * v.hi, b * v.lo));
473 }
474 
475 int
476 dcheck(INTERVAL v)
477 {
478     if (v.hi >= 0. && v.lo <= 0.)
479     {
480 	printf("divisor  interval  contains  0.\n");
481 	return (1);
482     }
483     return (0);
484 }
485 
486 INTERVAL
487 vdiv(double a, double b, INTERVAL v)
488 {
489     return (hilo(a / v.hi, a / v.lo, b / v.hi, b / v.lo));
490 }
491 #line 492 "varsyntax_calc1.tab.c"
492 
493 #if YYDEBUG
494 #include <stdio.h>	/* needed for printf */
495 #endif
496 
497 #include <stdlib.h>	/* needed for malloc, etc */
498 #include <string.h>	/* needed for memset */
499 
500 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
501 static int yygrowstack(YYSTACKDATA *data)
502 {
503     int i;
504     unsigned newsize;
505     YYINT *newss;
506     YYSTYPE *newvs;
507 
508     if ((newsize = data->stacksize) == 0)
509         newsize = YYINITSTACKSIZE;
510     else if (newsize >= YYMAXDEPTH)
511         return YYENOMEM;
512     else if ((newsize *= 2) > YYMAXDEPTH)
513         newsize = YYMAXDEPTH;
514 
515     i = (int) (data->s_mark - data->s_base);
516     newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
517     if (newss == 0)
518         return YYENOMEM;
519 
520     data->s_base = newss;
521     data->s_mark = newss + i;
522 
523     newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
524     if (newvs == 0)
525         return YYENOMEM;
526 
527     data->l_base = newvs;
528     data->l_mark = newvs + i;
529 
530     data->stacksize = newsize;
531     data->s_last = data->s_base + newsize - 1;
532     return 0;
533 }
534 
535 #if YYPURE || defined(YY_NO_LEAKS)
536 static void yyfreestack(YYSTACKDATA *data)
537 {
538     free(data->s_base);
539     free(data->l_base);
540     memset(data, 0, sizeof(*data));
541 }
542 #else
543 #define yyfreestack(data) /* nothing */
544 #endif
545 
546 #define YYABORT  goto yyabort
547 #define YYREJECT goto yyabort
548 #define YYACCEPT goto yyaccept
549 #define YYERROR  goto yyerrlab
550 
551 int
552 YYPARSE_DECL()
553 {
554     int yym, yyn, yystate;
555 #if YYDEBUG
556     const char *yys;
557 
558     if ((yys = getenv("YYDEBUG")) != 0)
559     {
560         yyn = *yys;
561         if (yyn >= '0' && yyn <= '9')
562             yydebug = yyn - '0';
563     }
564 #endif
565 
566     yym = 0;
567     yyn = 0;
568     yynerrs = 0;
569     yyerrflag = 0;
570     yychar = YYEMPTY;
571     yystate = 0;
572 
573 #if YYPURE
574     memset(&yystack, 0, sizeof(yystack));
575 #endif
576 
577     if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
578     yystack.s_mark = yystack.s_base;
579     yystack.l_mark = yystack.l_base;
580     yystate = 0;
581     *yystack.s_mark = 0;
582 
583 yyloop:
584     if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
585     if (yychar < 0)
586     {
587         yychar = YYLEX;
588         if (yychar < 0) yychar = YYEOF;
589 #if YYDEBUG
590         if (yydebug)
591         {
592             if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
593             printf("%sdebug: state %d, reading %d (%s)\n",
594                     YYPREFIX, yystate, yychar, yys);
595         }
596 #endif
597     }
598     if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
599             yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
600     {
601 #if YYDEBUG
602         if (yydebug)
603             printf("%sdebug: state %d, shifting to state %d\n",
604                     YYPREFIX, yystate, yytable[yyn]);
605 #endif
606         if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
607         yystate = yytable[yyn];
608         *++yystack.s_mark = yytable[yyn];
609         *++yystack.l_mark = yylval;
610         yychar = YYEMPTY;
611         if (yyerrflag > 0)  --yyerrflag;
612         goto yyloop;
613     }
614     if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
615             yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
616     {
617         yyn = yytable[yyn];
618         goto yyreduce;
619     }
620     if (yyerrflag != 0) goto yyinrecovery;
621 
622     YYERROR_CALL("syntax error");
623 
624     goto yyerrlab; /* redundant goto avoids 'unused label' warning */
625 yyerrlab:
626     ++yynerrs;
627 
628 yyinrecovery:
629     if (yyerrflag < 3)
630     {
631         yyerrflag = 3;
632         for (;;)
633         {
634             if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
635                     yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
636             {
637 #if YYDEBUG
638                 if (yydebug)
639                     printf("%sdebug: state %d, error recovery shifting\
640  to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
641 #endif
642                 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
643                 yystate = yytable[yyn];
644                 *++yystack.s_mark = yytable[yyn];
645                 *++yystack.l_mark = yylval;
646                 goto yyloop;
647             }
648             else
649             {
650 #if YYDEBUG
651                 if (yydebug)
652                     printf("%sdebug: error recovery discarding state %d\n",
653                             YYPREFIX, *yystack.s_mark);
654 #endif
655                 if (yystack.s_mark <= yystack.s_base) goto yyabort;
656                 --yystack.s_mark;
657                 --yystack.l_mark;
658             }
659         }
660     }
661     else
662     {
663         if (yychar == YYEOF) goto yyabort;
664 #if YYDEBUG
665         if (yydebug)
666         {
667             if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
668             printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
669                     YYPREFIX, yystate, yychar, yys);
670         }
671 #endif
672         yychar = YYEMPTY;
673         goto yyloop;
674     }
675 
676 yyreduce:
677 #if YYDEBUG
678     if (yydebug)
679         printf("%sdebug: state %d, reducing by rule %d (%s)\n",
680                 YYPREFIX, yystate, yyn, yyrule[yyn]);
681 #endif
682     yym = yylen[yyn];
683     if (yym > 0)
684         yyval = yystack.l_mark[1-yym];
685     else
686         memset(&yyval, 0, sizeof yyval);
687 
688     switch (yyn)
689     {
690 case 3:
691 #line 59 "varsyntax_calc1.y"
692 	{
693 		(void) printf("%15.8f\n", yystack.l_mark[-1].dval);
694 	}
695 break;
696 case 4:
697 #line 63 "varsyntax_calc1.y"
698 	{
699 		(void) printf("(%15.8f, %15.8f)\n", yystack.l_mark[-1].vval.lo, yystack.l_mark[-1].vval.hi);
700 	}
701 break;
702 case 5:
703 #line 67 "varsyntax_calc1.y"
704 	{
705 		dreg[yystack.l_mark[-3].ival] = yystack.l_mark[-1].dval;
706 	}
707 break;
708 case 6:
709 #line 71 "varsyntax_calc1.y"
710 	{
711 		vreg[yystack.l_mark[-3].ival] = yystack.l_mark[-1].vval;
712 	}
713 break;
714 case 7:
715 #line 75 "varsyntax_calc1.y"
716 	{
717 		yyerrok;
718 	}
719 break;
720 case 9:
721 #line 82 "varsyntax_calc1.y"
722 	{
723 		yyval.dval = dreg[yystack.l_mark[0].ival]; /* $$ & $1 are sufficient here*/
724 	}
725 break;
726 case 10:
727 #line 86 "varsyntax_calc1.y"
728 	{
729 		yyval.dval = yystack.l_mark[-2].dval + yystack.l_mark[0].dval;
730 	}
731 break;
732 case 11:
733 #line 90 "varsyntax_calc1.y"
734 	{
735 		yyval.dval = yystack.l_mark[-2].dval - yystack.l_mark[0].dval;
736 	}
737 break;
738 case 12:
739 #line 94 "varsyntax_calc1.y"
740 	{
741 		yyval.dval = yystack.l_mark[-2].dval * yystack.l_mark[0].dval;
742 	}
743 break;
744 case 13:
745 #line 98 "varsyntax_calc1.y"
746 	{
747 		yyval.dval = yystack.l_mark[-2].dval / yystack.l_mark[0].dval;
748 	}
749 break;
750 case 14:
751 #line 102 "varsyntax_calc1.y"
752 	{
753 		yyval.dval = -yystack.l_mark[0].dval;
754 	}
755 break;
756 case 15:
757 #line 106 "varsyntax_calc1.y"
758 	{
759 		yyval.dval = yystack.l_mark[-1].dval;
760 	}
761 break;
762 case 16:
763 #line 112 "varsyntax_calc1.y"
764 	{
765 		yyval.vval.hi = yyval.vval.lo = yystack.l_mark[0].dval;
766 	}
767 break;
768 case 17:
769 #line 116 "varsyntax_calc1.y"
770 	{
771 		yyval.vval.lo = yystack.l_mark[-3].dval;
772 		yyval.vval.hi = yystack.l_mark[-1].dval;
773 		if ( yyval.vval.lo > yyval.vval.hi )
774 		{
775 			(void) printf("interval out of order\n");
776 			YYERROR;
777 		}
778 	}
779 break;
780 case 18:
781 #line 126 "varsyntax_calc1.y"
782 	{
783 		yyval.vval = vreg[yystack.l_mark[0].ival];
784 	}
785 break;
786 case 19:
787 #line 130 "varsyntax_calc1.y"
788 	{
789 		yyval.vval.hi = yystack.l_mark[-2].vval.hi + yystack.l_mark[0].vval.hi;
790 		yyval.vval.lo = yystack.l_mark[-2].vval.lo + yystack.l_mark[0].vval.lo;
791 	}
792 break;
793 case 20:
794 #line 135 "varsyntax_calc1.y"
795 	{
796 		yyval.vval.hi = yystack.l_mark[-2].dval + yystack.l_mark[0].vval.hi;
797 		yyval.vval.lo = yystack.l_mark[-2].dval + yystack.l_mark[0].vval.lo;
798 	}
799 break;
800 case 21:
801 #line 140 "varsyntax_calc1.y"
802 	{
803 		yyval.vval.hi = yystack.l_mark[-2].vval.hi - yystack.l_mark[0].vval.lo;
804 		yyval.vval.lo = yystack.l_mark[-2].vval.lo - yystack.l_mark[0].vval.hi;
805 	}
806 break;
807 case 22:
808 #line 145 "varsyntax_calc1.y"
809 	{
810 		yyval.vval.hi = yystack.l_mark[-2].dval - yystack.l_mark[0].vval.lo;
811 		yyval.vval.lo = yystack.l_mark[-2].dval - yystack.l_mark[0].vval.hi;
812 	}
813 break;
814 case 23:
815 #line 150 "varsyntax_calc1.y"
816 	{
817 		yyval.vval = vmul( yystack.l_mark[-2].vval.lo, yystack.l_mark[-2].vval.hi, yystack.l_mark[0].vval );
818 	}
819 break;
820 case 24:
821 #line 154 "varsyntax_calc1.y"
822 	{
823 		yyval.vval = vmul (yystack.l_mark[-2].dval, yystack.l_mark[-2].dval, yystack.l_mark[0].vval );
824 	}
825 break;
826 case 25:
827 #line 158 "varsyntax_calc1.y"
828 	{
829 		if (dcheck(yystack.l_mark[0].vval)) YYERROR;
830 		yyval.vval = vdiv ( yystack.l_mark[-2].vval.lo, yystack.l_mark[-2].vval.hi, yystack.l_mark[0].vval );
831 	}
832 break;
833 case 26:
834 #line 163 "varsyntax_calc1.y"
835 	{
836 		if (dcheck ( yystack.l_mark[0].vval )) YYERROR;
837 		yyval.vval = vdiv (yystack.l_mark[-2].dval, yystack.l_mark[-2].dval, yystack.l_mark[0].vval );
838 	}
839 break;
840 case 27:
841 #line 168 "varsyntax_calc1.y"
842 	{
843 		yyval.vval.hi = -yystack.l_mark[0].vval.lo;
844 		yyval.vval.lo = -yystack.l_mark[0].vval.hi;
845 	}
846 break;
847 case 28:
848 #line 173 "varsyntax_calc1.y"
849 	{
850 		yyval.vval = yystack.l_mark[-1].vval;
851 	}
852 break;
853 #line 854 "varsyntax_calc1.tab.c"
854     }
855     yystack.s_mark -= yym;
856     yystate = *yystack.s_mark;
857     yystack.l_mark -= yym;
858     yym = yylhs[yyn];
859     if (yystate == 0 && yym == 0)
860     {
861 #if YYDEBUG
862         if (yydebug)
863             printf("%sdebug: after reduction, shifting from state 0 to\
864  state %d\n", YYPREFIX, YYFINAL);
865 #endif
866         yystate = YYFINAL;
867         *++yystack.s_mark = YYFINAL;
868         *++yystack.l_mark = yyval;
869         if (yychar < 0)
870         {
871             yychar = YYLEX;
872             if (yychar < 0) yychar = YYEOF;
873 #if YYDEBUG
874             if (yydebug)
875             {
876                 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
877                 printf("%sdebug: state %d, reading %d (%s)\n",
878                         YYPREFIX, YYFINAL, yychar, yys);
879             }
880 #endif
881         }
882         if (yychar == YYEOF) goto yyaccept;
883         goto yyloop;
884     }
885     if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
886             yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
887         yystate = yytable[yyn];
888     else
889         yystate = yydgoto[yym];
890 #if YYDEBUG
891     if (yydebug)
892         printf("%sdebug: after reduction, shifting from state %d \
893 to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
894 #endif
895     if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
896     *++yystack.s_mark = (YYINT) yystate;
897     *++yystack.l_mark = yyval;
898     goto yyloop;
899 
900 yyoverflow:
901     YYERROR_CALL("yacc stack overflow");
902 
903 yyabort:
904     yyfreestack(&yystack);
905     return (1);
906 
907 yyaccept:
908     yyfreestack(&yystack);
909     return (0);
910 }
911