added preload_usb hack
[tridge/junkcode.git] / rpcalc.tab.c
1
2 /*  A Bison parser, made from rpcalc.y
3  by  GNU Bison version 1.27
4   */
5
6 #define YYBISON 1  /* Identify Bison output.  */
7
8 #define NUM     257
9
10 #line 3 "rpcalc.y"
11
12      #define YYSTYPE double
13      #include <math.h>
14      #ifndef YYSTYPE
15 #define YYSTYPE int
16 #endif
17 #include <stdio.h>
18
19 #ifndef __cplusplus
20 #ifndef __STDC__
21 #define const
22 #endif
23 #endif
24
25
26
27 #define YYFINAL         15
28 #define YYFLAG          -32768
29 #define YYNTBASE        11
30
31 #define YYTRANSLATE(x) ((unsigned)(x) <= 257 ? yytranslate[x] : 14)
32
33 static const char yytranslate[] = {     0,
34      2,     2,     2,     2,     2,     2,     2,     2,     2,     4,
35      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
36      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
37      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
38      2,     7,     5,     2,     6,     2,     8,     2,     2,     2,
39      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
40      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
41      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
42      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
43      2,     2,     2,     9,     2,     2,     2,     2,     2,     2,
44      2,     2,     2,     2,     2,     2,     2,     2,     2,    10,
45      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
46      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
47      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
48      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
49      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
50      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
51      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
52      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
53      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
54      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
55      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
56      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
57      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
58      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
59      2,     2,     2,     2,     2,     1,     3
60 };
61
62 #if YYDEBUG != 0
63 static const short yyprhs[] = {     0,
64      0,     1,     4,     6,     9,    11,    15,    19,    23,    27,
65     31
66 };
67
68 static const short yyrhs[] = {    -1,
69     11,    12,     0,     4,     0,    13,     4,     0,     3,     0,
70     13,    13,     5,     0,    13,    13,     6,     0,    13,    13,
71      7,     0,    13,    13,     8,     0,    13,    13,     9,     0,
72     13,    10,     0
73 };
74
75 #endif
76
77 #if YYDEBUG != 0
78 static const short yyrline[] = { 0,
79     11,    12,    15,    16,    19,    20,    21,    22,    23,    25,
80     27
81 };
82 #endif
83
84
85 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
86
87 static const char * const yytname[] = {   "$","error","$undefined.","NUM","'\\n'",
88 "'+'","'-'","'*'","'/'","'^'","'n'","input","line","exp", NULL
89 };
90 #endif
91
92 static const short yyr1[] = {     0,
93     11,    11,    12,    12,    13,    13,    13,    13,    13,    13,
94     13
95 };
96
97 static const short yyr2[] = {     0,
98      0,     2,     1,     2,     1,     3,     3,     3,     3,     3,
99      2
100 };
101
102 static const short yydefact[] = {     1,
103      0,     5,     3,     2,     0,     4,    11,     0,     6,     7,
104      8,     9,    10,     0,     0
105 };
106
107 static const short yydefgoto[] = {     1,
108      4,     8
109 };
110
111 static const short yypact[] = {-32768,
112     10,-32768,-32768,-32768,     5,-32768,-32768,    -3,-32768,-32768,
113 -32768,-32768,-32768,     1,-32768
114 };
115
116 static const short yypgoto[] = {-32768,
117 -32768,    11
118 };
119
120
121 #define YYLAST          15
122
123
124 static const short yytable[] = {     2,
125     15,     9,    10,    11,    12,    13,     7,     2,     6,    14,
126      0,     5,     2,     3,     7
127 };
128
129 static const short yycheck[] = {     3,
130      0,     5,     6,     7,     8,     9,    10,     3,     4,     0,
131     -1,     1,     3,     4,    10
132 };
133 /* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
134 #line 3 "/usr/lib/bison.simple"
135 /* This file comes from bison-1.27.  */
136
137 /* Skeleton output parser for bison,
138    Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
139
140    This program is free software; you can redistribute it and/or modify
141    it under the terms of the GNU General Public License as published by
142    the Free Software Foundation; either version 2, or (at your option)
143    any later version.
144
145    This program is distributed in the hope that it will be useful,
146    but WITHOUT ANY WARRANTY; without even the implied warranty of
147    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
148    GNU General Public License for more details.
149
150    You should have received a copy of the GNU General Public License
151    along with this program; if not, write to the Free Software
152    Foundation, Inc., 59 Temple Place - Suite 330,
153    Boston, MA 02111-1307, USA.  */
154
155 /* As a special exception, when this file is copied by Bison into a
156    Bison output file, you may use that output file without restriction.
157    This special exception was added by the Free Software Foundation
158    in version 1.24 of Bison.  */
159
160 /* This is the parser code that is written into each bison parser
161   when the %semantic_parser declaration is not specified in the grammar.
162   It was written by Richard Stallman by simplifying the hairy parser
163   used when %semantic_parser is specified.  */
164
165 #ifndef YYSTACK_USE_ALLOCA
166 #ifdef alloca
167 #define YYSTACK_USE_ALLOCA
168 #else /* alloca not defined */
169 #ifdef __GNUC__
170 #define YYSTACK_USE_ALLOCA
171 #define alloca __builtin_alloca
172 #else /* not GNU C.  */
173 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
174 #define YYSTACK_USE_ALLOCA
175 #include <alloca.h>
176 #else /* not sparc */
177 /* We think this test detects Watcom and Microsoft C.  */
178 /* This used to test MSDOS, but that is a bad idea
179    since that symbol is in the user namespace.  */
180 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
181 #if 0 /* No need for malloc.h, which pollutes the namespace;
182          instead, just don't use alloca.  */
183 #include <malloc.h>
184 #endif
185 #else /* not MSDOS, or __TURBOC__ */
186 #if defined(_AIX)
187 /* I don't know what this was needed for, but it pollutes the namespace.
188    So I turned it off.   rms, 2 May 1997.  */
189 /* #include <malloc.h>  */
190  #pragma alloca
191 #define YYSTACK_USE_ALLOCA
192 #else /* not MSDOS, or __TURBOC__, or _AIX */
193 #if 0
194 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
195                  and on HPUX 10.  Eventually we can turn this on.  */
196 #define YYSTACK_USE_ALLOCA
197 #define alloca __builtin_alloca
198 #endif /* __hpux */
199 #endif
200 #endif /* not _AIX */
201 #endif /* not MSDOS, or __TURBOC__ */
202 #endif /* not sparc */
203 #endif /* not GNU C */
204 #endif /* alloca not defined */
205 #endif /* YYSTACK_USE_ALLOCA not defined */
206
207 #ifdef YYSTACK_USE_ALLOCA
208 #define YYSTACK_ALLOC alloca
209 #else
210 #define YYSTACK_ALLOC malloc
211 #endif
212
213 /* Note: there must be only one dollar sign in this file.
214    It is replaced by the list of actions, each action
215    as one case of the switch.  */
216
217 #define yyerrok         (yyerrstatus = 0)
218 #define yyclearin       (yychar = YYEMPTY)
219 #define YYEMPTY         -2
220 #define YYEOF           0
221 #define YYACCEPT        goto yyacceptlab
222 #define YYABORT         goto yyabortlab
223 #define YYERROR         goto yyerrlab1
224 /* Like YYERROR except do call yyerror.
225    This remains here temporarily to ease the
226    transition to the new meaning of YYERROR, for GCC.
227    Once GCC version 2 has supplanted version 1, this can go.  */
228 #define YYFAIL          goto yyerrlab
229 #define YYRECOVERING()  (!!yyerrstatus)
230 #define YYBACKUP(token, value) \
231 do                                                              \
232   if (yychar == YYEMPTY && yylen == 1)                          \
233     { yychar = (token), yylval = (value);                       \
234       yychar1 = YYTRANSLATE (yychar);                           \
235       YYPOPSTACK;                                               \
236       goto yybackup;                                            \
237     }                                                           \
238   else                                                          \
239     { yyerror ("syntax error: cannot back up"); YYERROR; }      \
240 while (0)
241
242 #define YYTERROR        1
243 #define YYERRCODE       256
244
245 #ifndef YYPURE
246 #define YYLEX           yylex()
247 #endif
248
249 #ifdef YYPURE
250 #ifdef YYLSP_NEEDED
251 #ifdef YYLEX_PARAM
252 #define YYLEX           yylex(&yylval, &yylloc, YYLEX_PARAM)
253 #else
254 #define YYLEX           yylex(&yylval, &yylloc)
255 #endif
256 #else /* not YYLSP_NEEDED */
257 #ifdef YYLEX_PARAM
258 #define YYLEX           yylex(&yylval, YYLEX_PARAM)
259 #else
260 #define YYLEX           yylex(&yylval)
261 #endif
262 #endif /* not YYLSP_NEEDED */
263 #endif
264
265 /* If nonreentrant, generate the variables here */
266
267 #ifndef YYPURE
268
269 int     yychar;                 /*  the lookahead symbol                */
270 YYSTYPE yylval;                 /*  the semantic value of the           */
271                                 /*  lookahead symbol                    */
272
273 #ifdef YYLSP_NEEDED
274 YYLTYPE yylloc;                 /*  location data for the lookahead     */
275                                 /*  symbol                              */
276 #endif
277
278 int yynerrs;                    /*  number of parse errors so far       */
279 #endif  /* not YYPURE */
280
281 #if YYDEBUG != 0
282 int yydebug;                    /*  nonzero means print parse trace     */
283 /* Since this is uninitialized, it does not stop multiple parsers
284    from coexisting.  */
285 #endif
286
287 /*  YYINITDEPTH indicates the initial size of the parser's stacks       */
288
289 #ifndef YYINITDEPTH
290 #define YYINITDEPTH 200
291 #endif
292
293 /*  YYMAXDEPTH is the maximum size the stacks can grow to
294     (effective only if the built-in stack extension method is used).  */
295
296 #if YYMAXDEPTH == 0
297 #undef YYMAXDEPTH
298 #endif
299
300 #ifndef YYMAXDEPTH
301 #define YYMAXDEPTH 10000
302 #endif
303 \f
304 /* Define __yy_memcpy.  Note that the size argument
305    should be passed with type unsigned int, because that is what the non-GCC
306    definitions require.  With GCC, __builtin_memcpy takes an arg
307    of type size_t, but it can handle unsigned int.  */
308
309 #if __GNUC__ > 1                /* GNU C and GNU C++ define this.  */
310 #define __yy_memcpy(TO,FROM,COUNT)      __builtin_memcpy(TO,FROM,COUNT)
311 #else                           /* not GNU C or C++ */
312 #ifndef __cplusplus
313
314 /* This is the most reliable way to avoid incompatibilities
315    in available built-in functions on various systems.  */
316 static void
317 __yy_memcpy (to, from, count)
318      char *to;
319      char *from;
320      unsigned int count;
321 {
322   register char *f = from;
323   register char *t = to;
324   register int i = count;
325
326   while (i-- > 0)
327     *t++ = *f++;
328 }
329
330 #else /* __cplusplus */
331
332 /* This is the most reliable way to avoid incompatibilities
333    in available built-in functions on various systems.  */
334 static void
335 __yy_memcpy (char *to, char *from, unsigned int count)
336 {
337   register char *t = to;
338   register char *f = from;
339   register int i = count;
340
341   while (i-- > 0)
342     *t++ = *f++;
343 }
344
345 #endif
346 #endif
347 \f
348 #line 216 "/usr/lib/bison.simple"
349
350 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
351    into yyparse.  The argument should have type void *.
352    It should actually point to an object.
353    Grammar actions can access the variable by casting it
354    to the proper pointer type.  */
355
356 #ifdef YYPARSE_PARAM
357 #ifdef __cplusplus
358 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
359 #define YYPARSE_PARAM_DECL
360 #else /* not __cplusplus */
361 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
362 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
363 #endif /* not __cplusplus */
364 #else /* not YYPARSE_PARAM */
365 #define YYPARSE_PARAM_ARG
366 #define YYPARSE_PARAM_DECL
367 #endif /* not YYPARSE_PARAM */
368
369 /* Prevent warning if -Wstrict-prototypes.  */
370 #ifdef __GNUC__
371 #ifdef YYPARSE_PARAM
372 int yyparse (void *);
373 #else
374 int yyparse (void);
375 #endif
376 #endif
377
378 int
379 yyparse(YYPARSE_PARAM_ARG)
380      YYPARSE_PARAM_DECL
381 {
382   register int yystate;
383   register int yyn;
384   register short *yyssp;
385   register YYSTYPE *yyvsp;
386   int yyerrstatus;      /*  number of tokens to shift before error messages enabled */
387   int yychar1 = 0;              /*  lookahead token as an internal (translated) token number */
388
389   short yyssa[YYINITDEPTH];     /*  the state stack                     */
390   YYSTYPE yyvsa[YYINITDEPTH];   /*  the semantic value stack            */
391
392   short *yyss = yyssa;          /*  refer to the stacks thru separate pointers */
393   YYSTYPE *yyvs = yyvsa;        /*  to allow yyoverflow to reallocate them elsewhere */
394
395 #ifdef YYLSP_NEEDED
396   YYLTYPE yylsa[YYINITDEPTH];   /*  the location stack                  */
397   YYLTYPE *yyls = yylsa;
398   YYLTYPE *yylsp;
399
400 #define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
401 #else
402 #define YYPOPSTACK   (yyvsp--, yyssp--)
403 #endif
404
405   int yystacksize = YYINITDEPTH;
406   int yyfree_stacks = 0;
407
408 #ifdef YYPURE
409   int yychar;
410   YYSTYPE yylval;
411   int yynerrs;
412 #ifdef YYLSP_NEEDED
413   YYLTYPE yylloc;
414 #endif
415 #endif
416
417   YYSTYPE yyval;                /*  the variable used to return         */
418                                 /*  semantic values from the action     */
419                                 /*  routines                            */
420
421   int yylen;
422
423 #if YYDEBUG != 0
424   if (yydebug)
425     fprintf(stderr, "Starting parse\n");
426 #endif
427
428   yystate = 0;
429   yyerrstatus = 0;
430   yynerrs = 0;
431   yychar = YYEMPTY;             /* Cause a token to be read.  */
432
433   /* Initialize stack pointers.
434      Waste one element of value and location stack
435      so that they stay on the same level as the state stack.
436      The wasted elements are never initialized.  */
437
438   yyssp = yyss - 1;
439   yyvsp = yyvs;
440 #ifdef YYLSP_NEEDED
441   yylsp = yyls;
442 #endif
443
444 /* Push a new state, which is found in  yystate  .  */
445 /* In all cases, when you get here, the value and location stacks
446    have just been pushed. so pushing a state here evens the stacks.  */
447 yynewstate:
448
449   *++yyssp = yystate;
450
451   if (yyssp >= yyss + yystacksize - 1)
452     {
453       /* Give user a chance to reallocate the stack */
454       /* Use copies of these so that the &'s don't force the real ones into memory. */
455       YYSTYPE *yyvs1 = yyvs;
456       short *yyss1 = yyss;
457 #ifdef YYLSP_NEEDED
458       YYLTYPE *yyls1 = yyls;
459 #endif
460
461       /* Get the current used size of the three stacks, in elements.  */
462       int size = yyssp - yyss + 1;
463
464 #ifdef yyoverflow
465       /* Each stack pointer address is followed by the size of
466          the data in use in that stack, in bytes.  */
467 #ifdef YYLSP_NEEDED
468       /* This used to be a conditional around just the two extra args,
469          but that might be undefined if yyoverflow is a macro.  */
470       yyoverflow("parser stack overflow",
471                  &yyss1, size * sizeof (*yyssp),
472                  &yyvs1, size * sizeof (*yyvsp),
473                  &yyls1, size * sizeof (*yylsp),
474                  &yystacksize);
475 #else
476       yyoverflow("parser stack overflow",
477                  &yyss1, size * sizeof (*yyssp),
478                  &yyvs1, size * sizeof (*yyvsp),
479                  &yystacksize);
480 #endif
481
482       yyss = yyss1; yyvs = yyvs1;
483 #ifdef YYLSP_NEEDED
484       yyls = yyls1;
485 #endif
486 #else /* no yyoverflow */
487       /* Extend the stack our own way.  */
488       if (yystacksize >= YYMAXDEPTH)
489         {
490           yyerror("parser stack overflow");
491           if (yyfree_stacks)
492             {
493               free (yyss);
494               free (yyvs);
495 #ifdef YYLSP_NEEDED
496               free (yyls);
497 #endif
498             }
499           return 2;
500         }
501       yystacksize *= 2;
502       if (yystacksize > YYMAXDEPTH)
503         yystacksize = YYMAXDEPTH;
504 #ifndef YYSTACK_USE_ALLOCA
505       yyfree_stacks = 1;
506 #endif
507       yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
508       __yy_memcpy ((char *)yyss, (char *)yyss1,
509                    size * (unsigned int) sizeof (*yyssp));
510       yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
511       __yy_memcpy ((char *)yyvs, (char *)yyvs1,
512                    size * (unsigned int) sizeof (*yyvsp));
513 #ifdef YYLSP_NEEDED
514       yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
515       __yy_memcpy ((char *)yyls, (char *)yyls1,
516                    size * (unsigned int) sizeof (*yylsp));
517 #endif
518 #endif /* no yyoverflow */
519
520       yyssp = yyss + size - 1;
521       yyvsp = yyvs + size - 1;
522 #ifdef YYLSP_NEEDED
523       yylsp = yyls + size - 1;
524 #endif
525
526 #if YYDEBUG != 0
527       if (yydebug)
528         fprintf(stderr, "Stack size increased to %d\n", yystacksize);
529 #endif
530
531       if (yyssp >= yyss + yystacksize - 1)
532         YYABORT;
533     }
534
535 #if YYDEBUG != 0
536   if (yydebug)
537     fprintf(stderr, "Entering state %d\n", yystate);
538 #endif
539
540   goto yybackup;
541  yybackup:
542
543 /* Do appropriate processing given the current state.  */
544 /* Read a lookahead token if we need one and don't already have one.  */
545 /* yyresume: */
546
547   /* First try to decide what to do without reference to lookahead token.  */
548
549   yyn = yypact[yystate];
550   if (yyn == YYFLAG)
551     goto yydefault;
552
553   /* Not known => get a lookahead token if don't already have one.  */
554
555   /* yychar is either YYEMPTY or YYEOF
556      or a valid token in external form.  */
557
558   if (yychar == YYEMPTY)
559     {
560 #if YYDEBUG != 0
561       if (yydebug)
562         fprintf(stderr, "Reading a token: ");
563 #endif
564       yychar = YYLEX;
565     }
566
567   /* Convert token to internal form (in yychar1) for indexing tables with */
568
569   if (yychar <= 0)              /* This means end of input. */
570     {
571       yychar1 = 0;
572       yychar = YYEOF;           /* Don't call YYLEX any more */
573
574 #if YYDEBUG != 0
575       if (yydebug)
576         fprintf(stderr, "Now at end of input.\n");
577 #endif
578     }
579   else
580     {
581       yychar1 = YYTRANSLATE(yychar);
582
583 #if YYDEBUG != 0
584       if (yydebug)
585         {
586           fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
587           /* Give the individual parser a way to print the precise meaning
588              of a token, for further debugging info.  */
589 #ifdef YYPRINT
590           YYPRINT (stderr, yychar, yylval);
591 #endif
592           fprintf (stderr, ")\n");
593         }
594 #endif
595     }
596
597   yyn += yychar1;
598   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
599     goto yydefault;
600
601   yyn = yytable[yyn];
602
603   /* yyn is what to do for this token type in this state.
604      Negative => reduce, -yyn is rule number.
605      Positive => shift, yyn is new state.
606        New state is final state => don't bother to shift,
607        just return success.
608      0, or most negative number => error.  */
609
610   if (yyn < 0)
611     {
612       if (yyn == YYFLAG)
613         goto yyerrlab;
614       yyn = -yyn;
615       goto yyreduce;
616     }
617   else if (yyn == 0)
618     goto yyerrlab;
619
620   if (yyn == YYFINAL)
621     YYACCEPT;
622
623   /* Shift the lookahead token.  */
624
625 #if YYDEBUG != 0
626   if (yydebug)
627     fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
628 #endif
629
630   /* Discard the token being shifted unless it is eof.  */
631   if (yychar != YYEOF)
632     yychar = YYEMPTY;
633
634   *++yyvsp = yylval;
635 #ifdef YYLSP_NEEDED
636   *++yylsp = yylloc;
637 #endif
638
639   /* count tokens shifted since error; after three, turn off error status.  */
640   if (yyerrstatus) yyerrstatus--;
641
642   yystate = yyn;
643   goto yynewstate;
644
645 /* Do the default action for the current state.  */
646 yydefault:
647
648   yyn = yydefact[yystate];
649   if (yyn == 0)
650     goto yyerrlab;
651
652 /* Do a reduction.  yyn is the number of a rule to reduce with.  */
653 yyreduce:
654   yylen = yyr2[yyn];
655   if (yylen > 0)
656     yyval = yyvsp[1-yylen]; /* implement default value of the action */
657
658 #if YYDEBUG != 0
659   if (yydebug)
660     {
661       int i;
662
663       fprintf (stderr, "Reducing via rule %d (line %d), ",
664                yyn, yyrline[yyn]);
665
666       /* Print the symbols being reduced, and their result.  */
667       for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
668         fprintf (stderr, "%s ", yytname[yyrhs[i]]);
669       fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
670     }
671 #endif
672
673
674   switch (yyn) {
675
676 case 4:
677 #line 16 "rpcalc.y"
678 { printf ("\t%.10g\n", yyvsp[-1]); ;
679     break;}
680 case 5:
681 #line 19 "rpcalc.y"
682 { yyval = yyvsp[0];         ;
683     break;}
684 case 6:
685 #line 20 "rpcalc.y"
686 { yyval = yyvsp[-2] + yyvsp[-1];    ;
687     break;}
688 case 7:
689 #line 21 "rpcalc.y"
690 { yyval = yyvsp[-2] - yyvsp[-1];    ;
691     break;}
692 case 8:
693 #line 22 "rpcalc.y"
694 { yyval = yyvsp[-2] * yyvsp[-1];    ;
695     break;}
696 case 9:
697 #line 23 "rpcalc.y"
698 { yyval = yyvsp[-2] / yyvsp[-1];    ;
699     break;}
700 case 10:
701 #line 25 "rpcalc.y"
702 { yyval = pow (yyvsp[-2], yyvsp[-1]); ;
703     break;}
704 case 11:
705 #line 27 "rpcalc.y"
706 { yyval = -yyvsp[-1];        ;
707     break;}
708 }
709    /* the action file gets copied in in place of this dollarsign */
710 #line 542 "/usr/lib/bison.simple"
711 \f
712   yyvsp -= yylen;
713   yyssp -= yylen;
714 #ifdef YYLSP_NEEDED
715   yylsp -= yylen;
716 #endif
717
718 #if YYDEBUG != 0
719   if (yydebug)
720     {
721       short *ssp1 = yyss - 1;
722       fprintf (stderr, "state stack now");
723       while (ssp1 != yyssp)
724         fprintf (stderr, " %d", *++ssp1);
725       fprintf (stderr, "\n");
726     }
727 #endif
728
729   *++yyvsp = yyval;
730
731 #ifdef YYLSP_NEEDED
732   yylsp++;
733   if (yylen == 0)
734     {
735       yylsp->first_line = yylloc.first_line;
736       yylsp->first_column = yylloc.first_column;
737       yylsp->last_line = (yylsp-1)->last_line;
738       yylsp->last_column = (yylsp-1)->last_column;
739       yylsp->text = 0;
740     }
741   else
742     {
743       yylsp->last_line = (yylsp+yylen-1)->last_line;
744       yylsp->last_column = (yylsp+yylen-1)->last_column;
745     }
746 #endif
747
748   /* Now "shift" the result of the reduction.
749      Determine what state that goes to,
750      based on the state we popped back to
751      and the rule number reduced by.  */
752
753   yyn = yyr1[yyn];
754
755   yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
756   if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
757     yystate = yytable[yystate];
758   else
759     yystate = yydefgoto[yyn - YYNTBASE];
760
761   goto yynewstate;
762
763 yyerrlab:   /* here on detecting error */
764
765   if (! yyerrstatus)
766     /* If not already recovering from an error, report this error.  */
767     {
768       ++yynerrs;
769
770 #ifdef YYERROR_VERBOSE
771       yyn = yypact[yystate];
772
773       if (yyn > YYFLAG && yyn < YYLAST)
774         {
775           int size = 0;
776           char *msg;
777           int x, count;
778
779           count = 0;
780           /* Start X at -yyn if nec to avoid negative indexes in yycheck.  */
781           for (x = (yyn < 0 ? -yyn : 0);
782                x < (sizeof(yytname) / sizeof(char *)); x++)
783             if (yycheck[x + yyn] == x)
784               size += strlen(yytname[x]) + 15, count++;
785           msg = (char *) malloc(size + 15);
786           if (msg != 0)
787             {
788               strcpy(msg, "parse error");
789
790               if (count < 5)
791                 {
792                   count = 0;
793                   for (x = (yyn < 0 ? -yyn : 0);
794                        x < (sizeof(yytname) / sizeof(char *)); x++)
795                     if (yycheck[x + yyn] == x)
796                       {
797                         strcat(msg, count == 0 ? ", expecting `" : " or `");
798                         strcat(msg, yytname[x]);
799                         strcat(msg, "'");
800                         count++;
801                       }
802                 }
803               yyerror(msg);
804               free(msg);
805             }
806           else
807             yyerror ("parse error; also virtual memory exceeded");
808         }
809       else
810 #endif /* YYERROR_VERBOSE */
811         yyerror("parse error");
812     }
813
814   goto yyerrlab1;
815 yyerrlab1:   /* here on error raised explicitly by an action */
816
817   if (yyerrstatus == 3)
818     {
819       /* if just tried and failed to reuse lookahead token after an error, discard it.  */
820
821       /* return failure if at end of input */
822       if (yychar == YYEOF)
823         YYABORT;
824
825 #if YYDEBUG != 0
826       if (yydebug)
827         fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
828 #endif
829
830       yychar = YYEMPTY;
831     }
832
833   /* Else will try to reuse lookahead token
834      after shifting the error token.  */
835
836   yyerrstatus = 3;              /* Each real token shifted decrements this */
837
838   goto yyerrhandle;
839
840 yyerrdefault:  /* current state does not do anything special for the error token. */
841
842 #if 0
843   /* This is wrong; only states that explicitly want error tokens
844      should shift them.  */
845   yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
846   if (yyn) goto yydefault;
847 #endif
848
849 yyerrpop:   /* pop the current state because it cannot handle the error token */
850
851   if (yyssp == yyss) YYABORT;
852   yyvsp--;
853   yystate = *--yyssp;
854 #ifdef YYLSP_NEEDED
855   yylsp--;
856 #endif
857
858 #if YYDEBUG != 0
859   if (yydebug)
860     {
861       short *ssp1 = yyss - 1;
862       fprintf (stderr, "Error: state stack now");
863       while (ssp1 != yyssp)
864         fprintf (stderr, " %d", *++ssp1);
865       fprintf (stderr, "\n");
866     }
867 #endif
868
869 yyerrhandle:
870
871   yyn = yypact[yystate];
872   if (yyn == YYFLAG)
873     goto yyerrdefault;
874
875   yyn += YYTERROR;
876   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
877     goto yyerrdefault;
878
879   yyn = yytable[yyn];
880   if (yyn < 0)
881     {
882       if (yyn == YYFLAG)
883         goto yyerrpop;
884       yyn = -yyn;
885       goto yyreduce;
886     }
887   else if (yyn == 0)
888     goto yyerrpop;
889
890   if (yyn == YYFINAL)
891     YYACCEPT;
892
893 #if YYDEBUG != 0
894   if (yydebug)
895     fprintf(stderr, "Shifting error token, ");
896 #endif
897
898   *++yyvsp = yylval;
899 #ifdef YYLSP_NEEDED
900   *++yylsp = yylloc;
901 #endif
902
903   yystate = yyn;
904   goto yynewstate;
905
906  yyacceptlab:
907   /* YYACCEPT comes here.  */
908   if (yyfree_stacks)
909     {
910       free (yyss);
911       free (yyvs);
912 #ifdef YYLSP_NEEDED
913       free (yyls);
914 #endif
915     }
916   return 0;
917
918  yyabortlab:
919   /* YYABORT comes here.  */
920   if (yyfree_stacks)
921     {
922       free (yyss);
923       free (yyvs);
924 #ifdef YYLSP_NEEDED
925       free (yyls);
926 #endif
927     }
928   return 1;
929 }
930 #line 29 "rpcalc.y"
931
932
933
934      /* Lexical analyzer returns a double floating point
935         number on the stack and the token NUM, or the ASCII
936         character read if not a number.  Skips all blanks
937         and tabs, returns 0 for EOF. */
938      
939      #include <ctype.h>
940      
941      yylex ()
942      {
943        int c;
944      
945        /* skip white space  */
946        while ((c = getchar ()) == ' ' || c == '\t')
947          ;
948        /* process numbers   */
949        if (c == '.' || isdigit (c))
950          {
951            ungetc (c, stdin);
952            scanf ("%lf", &yylval);
953            return NUM;
954          }
955        /* return end-of-file  */
956        if (c == EOF)
957          return 0;
958        /* return single chars */
959        return c;
960      }
961
962
963
964      main ()
965      {
966        yyparse ();
967      }
968
969
970      #include <stdio.h>
971      
972      yyerror (s)  /* Called by yyparse on error */
973           char *s;
974      {
975        printf ("%s\n", s);
976      }