10c8de5b0SBaptiste Daroussin /* original parser id follows */
20c8de5b0SBaptiste Daroussin /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
30c8de5b0SBaptiste Daroussin /* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
40c8de5b0SBaptiste Daroussin
50c8de5b0SBaptiste Daroussin #define YYBYACC 1
6*8e022d3cSDag-Erling Smørgrav #define YYMAJOR 2
7*8e022d3cSDag-Erling Smørgrav #define YYMINOR 0
80c8de5b0SBaptiste Daroussin #define YYCHECK "yyyymmdd"
90c8de5b0SBaptiste Daroussin
100c8de5b0SBaptiste Daroussin #define YYEMPTY (-1)
110c8de5b0SBaptiste Daroussin #define yyclearin (yychar = YYEMPTY)
120c8de5b0SBaptiste Daroussin #define yyerrok (yyerrflag = 0)
130c8de5b0SBaptiste Daroussin #define YYRECOVERING() (yyerrflag != 0)
140c8de5b0SBaptiste Daroussin #define YYENOMEM (-2)
150c8de5b0SBaptiste Daroussin #define YYEOF 0
160c8de5b0SBaptiste Daroussin
170c8de5b0SBaptiste Daroussin #ifndef yyparse
180c8de5b0SBaptiste Daroussin #define yyparse calc_parse
190c8de5b0SBaptiste Daroussin #endif /* yyparse */
200c8de5b0SBaptiste Daroussin
210c8de5b0SBaptiste Daroussin #ifndef yylex
220c8de5b0SBaptiste Daroussin #define yylex calc_lex
230c8de5b0SBaptiste Daroussin #endif /* yylex */
240c8de5b0SBaptiste Daroussin
250c8de5b0SBaptiste Daroussin #ifndef yyerror
260c8de5b0SBaptiste Daroussin #define yyerror calc_error
270c8de5b0SBaptiste Daroussin #endif /* yyerror */
280c8de5b0SBaptiste Daroussin
290c8de5b0SBaptiste Daroussin #ifndef yychar
300c8de5b0SBaptiste Daroussin #define yychar calc_char
310c8de5b0SBaptiste Daroussin #endif /* yychar */
320c8de5b0SBaptiste Daroussin
330c8de5b0SBaptiste Daroussin #ifndef yyval
340c8de5b0SBaptiste Daroussin #define yyval calc_val
350c8de5b0SBaptiste Daroussin #endif /* yyval */
360c8de5b0SBaptiste Daroussin
370c8de5b0SBaptiste Daroussin #ifndef yylval
380c8de5b0SBaptiste Daroussin #define yylval calc_lval
390c8de5b0SBaptiste Daroussin #endif /* yylval */
400c8de5b0SBaptiste Daroussin
410c8de5b0SBaptiste Daroussin #ifndef yydebug
420c8de5b0SBaptiste Daroussin #define yydebug calc_debug
430c8de5b0SBaptiste Daroussin #endif /* yydebug */
440c8de5b0SBaptiste Daroussin
450c8de5b0SBaptiste Daroussin #ifndef yynerrs
460c8de5b0SBaptiste Daroussin #define yynerrs calc_nerrs
470c8de5b0SBaptiste Daroussin #endif /* yynerrs */
480c8de5b0SBaptiste Daroussin
490c8de5b0SBaptiste Daroussin #ifndef yyerrflag
500c8de5b0SBaptiste Daroussin #define yyerrflag calc_errflag
510c8de5b0SBaptiste Daroussin #endif /* yyerrflag */
520c8de5b0SBaptiste Daroussin
530c8de5b0SBaptiste Daroussin #ifndef yylhs
540c8de5b0SBaptiste Daroussin #define yylhs calc_lhs
550c8de5b0SBaptiste Daroussin #endif /* yylhs */
560c8de5b0SBaptiste Daroussin
570c8de5b0SBaptiste Daroussin #ifndef yylen
580c8de5b0SBaptiste Daroussin #define yylen calc_len
590c8de5b0SBaptiste Daroussin #endif /* yylen */
600c8de5b0SBaptiste Daroussin
610c8de5b0SBaptiste Daroussin #ifndef yydefred
620c8de5b0SBaptiste Daroussin #define yydefred calc_defred
630c8de5b0SBaptiste Daroussin #endif /* yydefred */
640c8de5b0SBaptiste Daroussin
650c8de5b0SBaptiste Daroussin #ifndef yydgoto
660c8de5b0SBaptiste Daroussin #define yydgoto calc_dgoto
670c8de5b0SBaptiste Daroussin #endif /* yydgoto */
680c8de5b0SBaptiste Daroussin
690c8de5b0SBaptiste Daroussin #ifndef yysindex
700c8de5b0SBaptiste Daroussin #define yysindex calc_sindex
710c8de5b0SBaptiste Daroussin #endif /* yysindex */
720c8de5b0SBaptiste Daroussin
730c8de5b0SBaptiste Daroussin #ifndef yyrindex
740c8de5b0SBaptiste Daroussin #define yyrindex calc_rindex
750c8de5b0SBaptiste Daroussin #endif /* yyrindex */
760c8de5b0SBaptiste Daroussin
770c8de5b0SBaptiste Daroussin #ifndef yygindex
780c8de5b0SBaptiste Daroussin #define yygindex calc_gindex
790c8de5b0SBaptiste Daroussin #endif /* yygindex */
800c8de5b0SBaptiste Daroussin
810c8de5b0SBaptiste Daroussin #ifndef yytable
820c8de5b0SBaptiste Daroussin #define yytable calc_table
830c8de5b0SBaptiste Daroussin #endif /* yytable */
840c8de5b0SBaptiste Daroussin
850c8de5b0SBaptiste Daroussin #ifndef yycheck
860c8de5b0SBaptiste Daroussin #define yycheck calc_check
870c8de5b0SBaptiste Daroussin #endif /* yycheck */
880c8de5b0SBaptiste Daroussin
890c8de5b0SBaptiste Daroussin #ifndef yyname
900c8de5b0SBaptiste Daroussin #define yyname calc_name
910c8de5b0SBaptiste Daroussin #endif /* yyname */
920c8de5b0SBaptiste Daroussin
930c8de5b0SBaptiste Daroussin #ifndef yyrule
940c8de5b0SBaptiste Daroussin #define yyrule calc_rule
950c8de5b0SBaptiste Daroussin #endif /* yyrule */
960c8de5b0SBaptiste Daroussin #define YYPREFIX "calc_"
970c8de5b0SBaptiste Daroussin
980c8de5b0SBaptiste Daroussin #define YYPURE 0
990c8de5b0SBaptiste Daroussin
1000c8de5b0SBaptiste Daroussin #line 2 "calc.y"
1010c8de5b0SBaptiste Daroussin # include <stdio.h>
1020c8de5b0SBaptiste Daroussin # include <ctype.h>
1030c8de5b0SBaptiste Daroussin
1040c8de5b0SBaptiste Daroussin int regs[26];
1050c8de5b0SBaptiste Daroussin int base;
1060c8de5b0SBaptiste Daroussin
1070c8de5b0SBaptiste Daroussin extern int yylex(void);
1080c8de5b0SBaptiste Daroussin static void yyerror(const char *s);
1090c8de5b0SBaptiste Daroussin
1100c8de5b0SBaptiste Daroussin #line 111 "calc.tab.c"
1110c8de5b0SBaptiste Daroussin
1120c8de5b0SBaptiste Daroussin #if ! defined(YYSTYPE) && ! defined(YYSTYPE_IS_DECLARED)
1130c8de5b0SBaptiste Daroussin /* Default: YYSTYPE is the semantic value type. */
1140c8de5b0SBaptiste Daroussin typedef int YYSTYPE;
1150c8de5b0SBaptiste Daroussin # define YYSTYPE_IS_DECLARED 1
1160c8de5b0SBaptiste Daroussin #endif
1170c8de5b0SBaptiste Daroussin
1180c8de5b0SBaptiste Daroussin /* compatibility with bison */
1190c8de5b0SBaptiste Daroussin #ifdef YYPARSE_PARAM
1200c8de5b0SBaptiste Daroussin /* compatibility with FreeBSD */
1210c8de5b0SBaptiste Daroussin # ifdef YYPARSE_PARAM_TYPE
1220c8de5b0SBaptiste Daroussin # define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
1230c8de5b0SBaptiste Daroussin # else
1240c8de5b0SBaptiste Daroussin # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
1250c8de5b0SBaptiste Daroussin # endif
1260c8de5b0SBaptiste Daroussin #else
1270c8de5b0SBaptiste Daroussin # define YYPARSE_DECL() yyparse(void)
1280c8de5b0SBaptiste Daroussin #endif
1290c8de5b0SBaptiste Daroussin
1300c8de5b0SBaptiste Daroussin /* Parameters sent to lex. */
1310c8de5b0SBaptiste Daroussin #ifdef YYLEX_PARAM
1320c8de5b0SBaptiste Daroussin # define YYLEX_DECL() yylex(void *YYLEX_PARAM)
1330c8de5b0SBaptiste Daroussin # define YYLEX yylex(YYLEX_PARAM)
1340c8de5b0SBaptiste Daroussin #else
1350c8de5b0SBaptiste Daroussin # define YYLEX_DECL() yylex(void)
1360c8de5b0SBaptiste Daroussin # define YYLEX yylex()
1370c8de5b0SBaptiste Daroussin #endif
1380c8de5b0SBaptiste Daroussin
1390c8de5b0SBaptiste Daroussin /* Parameters sent to yyerror. */
1400c8de5b0SBaptiste Daroussin #ifndef YYERROR_DECL
1410c8de5b0SBaptiste Daroussin #define YYERROR_DECL() yyerror(const char *s)
1420c8de5b0SBaptiste Daroussin #endif
1430c8de5b0SBaptiste Daroussin #ifndef YYERROR_CALL
1440c8de5b0SBaptiste Daroussin #define YYERROR_CALL(msg) yyerror(msg)
1450c8de5b0SBaptiste Daroussin #endif
1460c8de5b0SBaptiste Daroussin
1470c8de5b0SBaptiste Daroussin extern int YYPARSE_DECL();
1480c8de5b0SBaptiste Daroussin
1490c8de5b0SBaptiste Daroussin #define DIGIT 257
1500c8de5b0SBaptiste Daroussin #define LETTER 258
1510c8de5b0SBaptiste Daroussin #define UMINUS 259
1520c8de5b0SBaptiste Daroussin #define YYERRCODE 256
153ea2af5c8SJung-uk Kim typedef int YYINT;
1540c8de5b0SBaptiste Daroussin static const YYINT calc_lhs[] = { -1,
1550c8de5b0SBaptiste Daroussin 0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
1560c8de5b0SBaptiste Daroussin 2, 2, 2, 2, 2, 2, 3, 3,
1570c8de5b0SBaptiste Daroussin };
1580c8de5b0SBaptiste Daroussin static const YYINT calc_len[] = { 2,
1590c8de5b0SBaptiste Daroussin 0, 3, 3, 1, 3, 3, 3, 3, 3, 3,
1600c8de5b0SBaptiste Daroussin 3, 3, 3, 2, 1, 1, 1, 2,
1610c8de5b0SBaptiste Daroussin };
1620c8de5b0SBaptiste Daroussin static const YYINT calc_defred[] = { 1,
1630c8de5b0SBaptiste Daroussin 0, 0, 17, 0, 0, 0, 0, 0, 0, 3,
1640c8de5b0SBaptiste Daroussin 0, 15, 14, 0, 2, 0, 0, 0, 0, 0,
1650c8de5b0SBaptiste Daroussin 0, 0, 18, 0, 6, 0, 0, 0, 0, 9,
1660c8de5b0SBaptiste Daroussin 10, 11,
1670c8de5b0SBaptiste Daroussin };
1680c8de5b0SBaptiste Daroussin static const YYINT calc_dgoto[] = { 1,
1690c8de5b0SBaptiste Daroussin 7, 8, 9,
1700c8de5b0SBaptiste Daroussin };
1710c8de5b0SBaptiste Daroussin static const YYINT calc_sindex[] = { 0,
1720c8de5b0SBaptiste Daroussin -40, -7, 0, -55, -38, -38, 1, -29, -247, 0,
1730c8de5b0SBaptiste Daroussin -38, 0, 0, 22, 0, -38, -38, -38, -38, -38,
1740c8de5b0SBaptiste Daroussin -38, -38, 0, -29, 0, 51, 60, -20, -20, 0,
1750c8de5b0SBaptiste Daroussin 0, 0,
1760c8de5b0SBaptiste Daroussin };
1770c8de5b0SBaptiste Daroussin static const YYINT calc_rindex[] = { 0,
1780c8de5b0SBaptiste Daroussin 0, 0, 0, 2, 0, 0, 0, 9, -9, 0,
1790c8de5b0SBaptiste Daroussin 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1800c8de5b0SBaptiste Daroussin 0, 0, 0, 10, 0, -6, 14, 5, 13, 0,
1810c8de5b0SBaptiste Daroussin 0, 0,
1820c8de5b0SBaptiste Daroussin };
1830c8de5b0SBaptiste Daroussin static const YYINT calc_gindex[] = { 0,
1840c8de5b0SBaptiste Daroussin 0, 65, 0,
1850c8de5b0SBaptiste Daroussin };
1860c8de5b0SBaptiste Daroussin #define YYTABLESIZE 220
1870c8de5b0SBaptiste Daroussin static const YYINT calc_table[] = { 6,
1880c8de5b0SBaptiste Daroussin 16, 6, 10, 13, 5, 11, 5, 22, 17, 23,
1890c8de5b0SBaptiste Daroussin 15, 15, 20, 18, 7, 19, 22, 21, 4, 5,
1900c8de5b0SBaptiste Daroussin 0, 20, 8, 12, 0, 0, 21, 16, 16, 0,
1910c8de5b0SBaptiste Daroussin 0, 16, 16, 16, 13, 16, 0, 16, 15, 15,
1920c8de5b0SBaptiste Daroussin 0, 0, 7, 15, 15, 7, 15, 7, 15, 7,
1930c8de5b0SBaptiste Daroussin 8, 12, 0, 8, 12, 8, 0, 8, 22, 17,
1940c8de5b0SBaptiste Daroussin 0, 0, 25, 20, 18, 0, 19, 0, 21, 13,
1950c8de5b0SBaptiste Daroussin 14, 0, 0, 0, 0, 24, 0, 0, 0, 0,
1960c8de5b0SBaptiste Daroussin 26, 27, 28, 29, 30, 31, 32, 22, 17, 0,
1970c8de5b0SBaptiste Daroussin 0, 0, 20, 18, 16, 19, 22, 21, 0, 0,
1980c8de5b0SBaptiste Daroussin 0, 20, 18, 0, 19, 0, 21, 0, 0, 0,
1990c8de5b0SBaptiste Daroussin 0, 0, 0, 0, 16, 0, 0, 13, 0, 0,
2000c8de5b0SBaptiste Daroussin 0, 0, 0, 0, 0, 15, 0, 0, 7, 0,
2010c8de5b0SBaptiste Daroussin 0, 0, 0, 0, 0, 0, 8, 12, 0, 0,
2020c8de5b0SBaptiste Daroussin 0, 0, 0, 0, 0, 16, 0, 0, 0, 0,
2030c8de5b0SBaptiste Daroussin 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2040c8de5b0SBaptiste Daroussin 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2050c8de5b0SBaptiste Daroussin 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2060c8de5b0SBaptiste Daroussin 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2070c8de5b0SBaptiste Daroussin 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2080c8de5b0SBaptiste Daroussin 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2090c8de5b0SBaptiste Daroussin 0, 0, 0, 0, 0, 2, 3, 4, 3, 12,
2100c8de5b0SBaptiste Daroussin };
2110c8de5b0SBaptiste Daroussin static const YYINT calc_check[] = { 40,
2120c8de5b0SBaptiste Daroussin 10, 40, 10, 10, 45, 61, 45, 37, 38, 257,
2130c8de5b0SBaptiste Daroussin 10, 10, 42, 43, 10, 45, 37, 47, 10, 10,
2140c8de5b0SBaptiste Daroussin -1, 42, 10, 10, -1, -1, 47, 37, 38, -1,
2150c8de5b0SBaptiste Daroussin -1, 41, 42, 43, 41, 45, -1, 47, 37, 38,
2160c8de5b0SBaptiste Daroussin -1, -1, 38, 42, 43, 41, 45, 43, 47, 45,
2170c8de5b0SBaptiste Daroussin 38, 38, -1, 41, 41, 43, -1, 45, 37, 38,
2180c8de5b0SBaptiste Daroussin -1, -1, 41, 42, 43, -1, 45, -1, 47, 5,
2190c8de5b0SBaptiste Daroussin 6, -1, -1, -1, -1, 11, -1, -1, -1, -1,
2200c8de5b0SBaptiste Daroussin 16, 17, 18, 19, 20, 21, 22, 37, 38, -1,
2210c8de5b0SBaptiste Daroussin -1, -1, 42, 43, 124, 45, 37, 47, -1, -1,
2220c8de5b0SBaptiste Daroussin -1, 42, 43, -1, 45, -1, 47, -1, -1, -1,
2230c8de5b0SBaptiste Daroussin -1, -1, -1, -1, 124, -1, -1, 124, -1, -1,
2240c8de5b0SBaptiste Daroussin -1, -1, -1, -1, -1, 124, -1, -1, 124, -1,
2250c8de5b0SBaptiste Daroussin -1, -1, -1, -1, -1, -1, 124, 124, -1, -1,
2260c8de5b0SBaptiste Daroussin -1, -1, -1, -1, -1, 124, -1, -1, -1, -1,
2270c8de5b0SBaptiste Daroussin -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2280c8de5b0SBaptiste Daroussin -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2290c8de5b0SBaptiste Daroussin -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2300c8de5b0SBaptiste Daroussin -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2310c8de5b0SBaptiste Daroussin -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2320c8de5b0SBaptiste Daroussin -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2330c8de5b0SBaptiste Daroussin -1, -1, -1, -1, -1, 256, 257, 258, 257, 258,
2340c8de5b0SBaptiste Daroussin };
2350c8de5b0SBaptiste Daroussin #define YYFINAL 1
2360c8de5b0SBaptiste Daroussin #ifndef YYDEBUG
2370c8de5b0SBaptiste Daroussin #define YYDEBUG 0
2380c8de5b0SBaptiste Daroussin #endif
2390c8de5b0SBaptiste Daroussin #define YYMAXTOKEN 259
2400c8de5b0SBaptiste Daroussin #define YYUNDFTOKEN 265
2410c8de5b0SBaptiste Daroussin #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
2420c8de5b0SBaptiste Daroussin #if YYDEBUG
2430c8de5b0SBaptiste Daroussin static const char *const calc_name[] = {
2440c8de5b0SBaptiste Daroussin
2450c8de5b0SBaptiste Daroussin "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,
2460c8de5b0SBaptiste Daroussin 0,0,0,0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'",0,"'-'",0,"'/'",0,0,0,0,0,0,0,
2470c8de5b0SBaptiste Daroussin 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,
2480c8de5b0SBaptiste Daroussin 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,
2490c8de5b0SBaptiste Daroussin 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,
2500c8de5b0SBaptiste Daroussin 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,
2510c8de5b0SBaptiste Daroussin 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,
2520c8de5b0SBaptiste Daroussin 0,0,0,0,0,0,"DIGIT","LETTER","UMINUS",0,0,0,0,0,"illegal-symbol",
2530c8de5b0SBaptiste Daroussin };
2540c8de5b0SBaptiste Daroussin static const char *const calc_rule[] = {
2550c8de5b0SBaptiste Daroussin "$accept : list",
2560c8de5b0SBaptiste Daroussin "list :",
2570c8de5b0SBaptiste Daroussin "list : list stat '\\n'",
2580c8de5b0SBaptiste Daroussin "list : list error '\\n'",
2590c8de5b0SBaptiste Daroussin "stat : expr",
2600c8de5b0SBaptiste Daroussin "stat : LETTER '=' expr",
2610c8de5b0SBaptiste Daroussin "expr : '(' expr ')'",
2620c8de5b0SBaptiste Daroussin "expr : expr '+' expr",
2630c8de5b0SBaptiste Daroussin "expr : expr '-' expr",
2640c8de5b0SBaptiste Daroussin "expr : expr '*' expr",
2650c8de5b0SBaptiste Daroussin "expr : expr '/' expr",
2660c8de5b0SBaptiste Daroussin "expr : expr '%' expr",
2670c8de5b0SBaptiste Daroussin "expr : expr '&' expr",
2680c8de5b0SBaptiste Daroussin "expr : expr '|' expr",
2690c8de5b0SBaptiste Daroussin "expr : '-' expr",
2700c8de5b0SBaptiste Daroussin "expr : LETTER",
2710c8de5b0SBaptiste Daroussin "expr : number",
2720c8de5b0SBaptiste Daroussin "number : DIGIT",
2730c8de5b0SBaptiste Daroussin "number : number DIGIT",
2740c8de5b0SBaptiste Daroussin
2750c8de5b0SBaptiste Daroussin };
2760c8de5b0SBaptiste Daroussin #endif
2770c8de5b0SBaptiste Daroussin
278b53bb29fSJung-uk Kim #if YYDEBUG
2790c8de5b0SBaptiste Daroussin int yydebug;
280b53bb29fSJung-uk Kim #endif
2810c8de5b0SBaptiste Daroussin
2820c8de5b0SBaptiste Daroussin int yyerrflag;
2830c8de5b0SBaptiste Daroussin int yychar;
2840c8de5b0SBaptiste Daroussin YYSTYPE yyval;
2850c8de5b0SBaptiste Daroussin YYSTYPE yylval;
286b53bb29fSJung-uk Kim int yynerrs;
2870c8de5b0SBaptiste Daroussin
2880c8de5b0SBaptiste Daroussin /* define the initial stack-sizes */
2890c8de5b0SBaptiste Daroussin #ifdef YYSTACKSIZE
2900c8de5b0SBaptiste Daroussin #undef YYMAXDEPTH
2910c8de5b0SBaptiste Daroussin #define YYMAXDEPTH YYSTACKSIZE
2920c8de5b0SBaptiste Daroussin #else
2930c8de5b0SBaptiste Daroussin #ifdef YYMAXDEPTH
2940c8de5b0SBaptiste Daroussin #define YYSTACKSIZE YYMAXDEPTH
2950c8de5b0SBaptiste Daroussin #else
2960c8de5b0SBaptiste Daroussin #define YYSTACKSIZE 10000
2970c8de5b0SBaptiste Daroussin #define YYMAXDEPTH 10000
2980c8de5b0SBaptiste Daroussin #endif
2990c8de5b0SBaptiste Daroussin #endif
3000c8de5b0SBaptiste Daroussin
3010c8de5b0SBaptiste Daroussin #define YYINITSTACKSIZE 200
3020c8de5b0SBaptiste Daroussin
3030c8de5b0SBaptiste Daroussin typedef struct {
3040c8de5b0SBaptiste Daroussin unsigned stacksize;
3050c8de5b0SBaptiste Daroussin YYINT *s_base;
3060c8de5b0SBaptiste Daroussin YYINT *s_mark;
3070c8de5b0SBaptiste Daroussin YYINT *s_last;
3080c8de5b0SBaptiste Daroussin YYSTYPE *l_base;
3090c8de5b0SBaptiste Daroussin YYSTYPE *l_mark;
3100c8de5b0SBaptiste Daroussin } YYSTACKDATA;
3110c8de5b0SBaptiste Daroussin /* variables for the parser stack */
3120c8de5b0SBaptiste Daroussin static YYSTACKDATA yystack;
3130c8de5b0SBaptiste Daroussin #line 66 "calc.y"
3140c8de5b0SBaptiste Daroussin /* start of programs */
3150c8de5b0SBaptiste Daroussin
3160c8de5b0SBaptiste Daroussin int
main(void)3170c8de5b0SBaptiste Daroussin main (void)
3180c8de5b0SBaptiste Daroussin {
3190c8de5b0SBaptiste Daroussin while(!feof(stdin)) {
3200c8de5b0SBaptiste Daroussin yyparse();
3210c8de5b0SBaptiste Daroussin }
3220c8de5b0SBaptiste Daroussin return 0;
3230c8de5b0SBaptiste Daroussin }
3240c8de5b0SBaptiste Daroussin
3250c8de5b0SBaptiste Daroussin static void
yyerror(const char * s)3260c8de5b0SBaptiste Daroussin yyerror(const char *s)
3270c8de5b0SBaptiste Daroussin {
3280c8de5b0SBaptiste Daroussin fprintf(stderr, "%s\n", s);
3290c8de5b0SBaptiste Daroussin }
3300c8de5b0SBaptiste Daroussin
3310c8de5b0SBaptiste Daroussin int
yylex(void)3320c8de5b0SBaptiste Daroussin yylex(void)
3330c8de5b0SBaptiste Daroussin {
3340c8de5b0SBaptiste Daroussin /* lexical analysis routine */
3350c8de5b0SBaptiste Daroussin /* returns LETTER for a lower case letter, yylval = 0 through 25 */
3360c8de5b0SBaptiste Daroussin /* return DIGIT for a digit, yylval = 0 through 9 */
3370c8de5b0SBaptiste Daroussin /* all other characters are returned immediately */
3380c8de5b0SBaptiste Daroussin
3390c8de5b0SBaptiste Daroussin int c;
3400c8de5b0SBaptiste Daroussin
3410c8de5b0SBaptiste Daroussin while( (c=getchar()) == ' ' ) { /* skip blanks */ }
3420c8de5b0SBaptiste Daroussin
3430c8de5b0SBaptiste Daroussin /* c is now nonblank */
3440c8de5b0SBaptiste Daroussin
3450c8de5b0SBaptiste Daroussin if( islower( c )) {
3460c8de5b0SBaptiste Daroussin yylval = c - 'a';
3470c8de5b0SBaptiste Daroussin return ( LETTER );
3480c8de5b0SBaptiste Daroussin }
3490c8de5b0SBaptiste Daroussin if( isdigit( c )) {
3500c8de5b0SBaptiste Daroussin yylval = c - '0';
3510c8de5b0SBaptiste Daroussin return ( DIGIT );
3520c8de5b0SBaptiste Daroussin }
3530c8de5b0SBaptiste Daroussin return( c );
3540c8de5b0SBaptiste Daroussin }
355b53bb29fSJung-uk Kim #line 356 "calc.tab.c"
3560c8de5b0SBaptiste Daroussin
3570c8de5b0SBaptiste Daroussin #if YYDEBUG
3580c8de5b0SBaptiste Daroussin #include <stdio.h> /* needed for printf */
3590c8de5b0SBaptiste Daroussin #endif
3600c8de5b0SBaptiste Daroussin
3610c8de5b0SBaptiste Daroussin #include <stdlib.h> /* needed for malloc, etc */
3620c8de5b0SBaptiste Daroussin #include <string.h> /* needed for memset */
3630c8de5b0SBaptiste Daroussin
3640c8de5b0SBaptiste Daroussin /* allocate initial stack or double stack size, up to YYMAXDEPTH */
yygrowstack(YYSTACKDATA * data)3650c8de5b0SBaptiste Daroussin static int yygrowstack(YYSTACKDATA *data)
3660c8de5b0SBaptiste Daroussin {
3670c8de5b0SBaptiste Daroussin int i;
3680c8de5b0SBaptiste Daroussin unsigned newsize;
3690c8de5b0SBaptiste Daroussin YYINT *newss;
3700c8de5b0SBaptiste Daroussin YYSTYPE *newvs;
3710c8de5b0SBaptiste Daroussin
3720c8de5b0SBaptiste Daroussin if ((newsize = data->stacksize) == 0)
3730c8de5b0SBaptiste Daroussin newsize = YYINITSTACKSIZE;
3740c8de5b0SBaptiste Daroussin else if (newsize >= YYMAXDEPTH)
3750c8de5b0SBaptiste Daroussin return YYENOMEM;
3760c8de5b0SBaptiste Daroussin else if ((newsize *= 2) > YYMAXDEPTH)
3770c8de5b0SBaptiste Daroussin newsize = YYMAXDEPTH;
3780c8de5b0SBaptiste Daroussin
3790c8de5b0SBaptiste Daroussin i = (int) (data->s_mark - data->s_base);
3800c8de5b0SBaptiste Daroussin newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
381bf80e08eSJung-uk Kim if (newss == NULL)
3820c8de5b0SBaptiste Daroussin return YYENOMEM;
3830c8de5b0SBaptiste Daroussin
3840c8de5b0SBaptiste Daroussin data->s_base = newss;
3850c8de5b0SBaptiste Daroussin data->s_mark = newss + i;
3860c8de5b0SBaptiste Daroussin
3870c8de5b0SBaptiste Daroussin newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
388bf80e08eSJung-uk Kim if (newvs == NULL)
3890c8de5b0SBaptiste Daroussin return YYENOMEM;
3900c8de5b0SBaptiste Daroussin
3910c8de5b0SBaptiste Daroussin data->l_base = newvs;
3920c8de5b0SBaptiste Daroussin data->l_mark = newvs + i;
3930c8de5b0SBaptiste Daroussin
3940c8de5b0SBaptiste Daroussin data->stacksize = newsize;
3950c8de5b0SBaptiste Daroussin data->s_last = data->s_base + newsize - 1;
3960c8de5b0SBaptiste Daroussin return 0;
3970c8de5b0SBaptiste Daroussin }
3980c8de5b0SBaptiste Daroussin
3990c8de5b0SBaptiste Daroussin #if YYPURE || defined(YY_NO_LEAKS)
yyfreestack(YYSTACKDATA * data)4000c8de5b0SBaptiste Daroussin static void yyfreestack(YYSTACKDATA *data)
4010c8de5b0SBaptiste Daroussin {
4020c8de5b0SBaptiste Daroussin free(data->s_base);
4030c8de5b0SBaptiste Daroussin free(data->l_base);
4040c8de5b0SBaptiste Daroussin memset(data, 0, sizeof(*data));
4050c8de5b0SBaptiste Daroussin }
4060c8de5b0SBaptiste Daroussin #else
4070c8de5b0SBaptiste Daroussin #define yyfreestack(data) /* nothing */
4080c8de5b0SBaptiste Daroussin #endif
4090c8de5b0SBaptiste Daroussin
4100c8de5b0SBaptiste Daroussin #define YYABORT goto yyabort
4110c8de5b0SBaptiste Daroussin #define YYREJECT goto yyabort
4120c8de5b0SBaptiste Daroussin #define YYACCEPT goto yyaccept
4130c8de5b0SBaptiste Daroussin #define YYERROR goto yyerrlab
4140c8de5b0SBaptiste Daroussin
4150c8de5b0SBaptiste Daroussin int
YYPARSE_DECL()4160c8de5b0SBaptiste Daroussin YYPARSE_DECL()
4170c8de5b0SBaptiste Daroussin {
4180c8de5b0SBaptiste Daroussin int yym, yyn, yystate;
4190c8de5b0SBaptiste Daroussin #if YYDEBUG
4200c8de5b0SBaptiste Daroussin const char *yys;
4210c8de5b0SBaptiste Daroussin
422bf80e08eSJung-uk Kim if ((yys = getenv("YYDEBUG")) != NULL)
4230c8de5b0SBaptiste Daroussin {
4240c8de5b0SBaptiste Daroussin yyn = *yys;
4250c8de5b0SBaptiste Daroussin if (yyn >= '0' && yyn <= '9')
4260c8de5b0SBaptiste Daroussin yydebug = yyn - '0';
4270c8de5b0SBaptiste Daroussin }
4280c8de5b0SBaptiste Daroussin #endif
4290c8de5b0SBaptiste Daroussin
430*8e022d3cSDag-Erling Smørgrav /* yym is set below */
431*8e022d3cSDag-Erling Smørgrav /* yyn is set below */
4320c8de5b0SBaptiste Daroussin yynerrs = 0;
4330c8de5b0SBaptiste Daroussin yyerrflag = 0;
4340c8de5b0SBaptiste Daroussin yychar = YYEMPTY;
4350c8de5b0SBaptiste Daroussin yystate = 0;
4360c8de5b0SBaptiste Daroussin
4370c8de5b0SBaptiste Daroussin #if YYPURE
4380c8de5b0SBaptiste Daroussin memset(&yystack, 0, sizeof(yystack));
4390c8de5b0SBaptiste Daroussin #endif
4400c8de5b0SBaptiste Daroussin
4410c8de5b0SBaptiste Daroussin if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
4420c8de5b0SBaptiste Daroussin yystack.s_mark = yystack.s_base;
4430c8de5b0SBaptiste Daroussin yystack.l_mark = yystack.l_base;
4440c8de5b0SBaptiste Daroussin yystate = 0;
4450c8de5b0SBaptiste Daroussin *yystack.s_mark = 0;
4460c8de5b0SBaptiste Daroussin
4470c8de5b0SBaptiste Daroussin yyloop:
4480c8de5b0SBaptiste Daroussin if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
4490c8de5b0SBaptiste Daroussin if (yychar < 0)
4500c8de5b0SBaptiste Daroussin {
451c5b5d71aSJung-uk Kim yychar = YYLEX;
452c5b5d71aSJung-uk Kim if (yychar < 0) yychar = YYEOF;
4530c8de5b0SBaptiste Daroussin #if YYDEBUG
4540c8de5b0SBaptiste Daroussin if (yydebug)
4550c8de5b0SBaptiste Daroussin {
456c5b5d71aSJung-uk Kim if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
4570c8de5b0SBaptiste Daroussin printf("%sdebug: state %d, reading %d (%s)\n",
4580c8de5b0SBaptiste Daroussin YYPREFIX, yystate, yychar, yys);
4590c8de5b0SBaptiste Daroussin }
4600c8de5b0SBaptiste Daroussin #endif
4610c8de5b0SBaptiste Daroussin }
462c5b5d71aSJung-uk Kim if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
463c5b5d71aSJung-uk Kim yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
4640c8de5b0SBaptiste Daroussin {
4650c8de5b0SBaptiste Daroussin #if YYDEBUG
4660c8de5b0SBaptiste Daroussin if (yydebug)
4670c8de5b0SBaptiste Daroussin printf("%sdebug: state %d, shifting to state %d\n",
4680c8de5b0SBaptiste Daroussin YYPREFIX, yystate, yytable[yyn]);
4690c8de5b0SBaptiste Daroussin #endif
470c5b5d71aSJung-uk Kim if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
4710c8de5b0SBaptiste Daroussin yystate = yytable[yyn];
4720c8de5b0SBaptiste Daroussin *++yystack.s_mark = yytable[yyn];
4730c8de5b0SBaptiste Daroussin *++yystack.l_mark = yylval;
4740c8de5b0SBaptiste Daroussin yychar = YYEMPTY;
4750c8de5b0SBaptiste Daroussin if (yyerrflag > 0) --yyerrflag;
4760c8de5b0SBaptiste Daroussin goto yyloop;
4770c8de5b0SBaptiste Daroussin }
478c5b5d71aSJung-uk Kim if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
479c5b5d71aSJung-uk Kim yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
4800c8de5b0SBaptiste Daroussin {
4810c8de5b0SBaptiste Daroussin yyn = yytable[yyn];
4820c8de5b0SBaptiste Daroussin goto yyreduce;
4830c8de5b0SBaptiste Daroussin }
484c5b5d71aSJung-uk Kim if (yyerrflag != 0) goto yyinrecovery;
4850c8de5b0SBaptiste Daroussin
4860c8de5b0SBaptiste Daroussin YYERROR_CALL("syntax error");
4870c8de5b0SBaptiste Daroussin
488c5b5d71aSJung-uk Kim goto yyerrlab; /* redundant goto avoids 'unused label' warning */
4890c8de5b0SBaptiste Daroussin yyerrlab:
4900c8de5b0SBaptiste Daroussin ++yynerrs;
4910c8de5b0SBaptiste Daroussin
4920c8de5b0SBaptiste Daroussin yyinrecovery:
4930c8de5b0SBaptiste Daroussin if (yyerrflag < 3)
4940c8de5b0SBaptiste Daroussin {
4950c8de5b0SBaptiste Daroussin yyerrflag = 3;
4960c8de5b0SBaptiste Daroussin for (;;)
4970c8de5b0SBaptiste Daroussin {
498c5b5d71aSJung-uk Kim if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
499c5b5d71aSJung-uk Kim yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
5000c8de5b0SBaptiste Daroussin {
5010c8de5b0SBaptiste Daroussin #if YYDEBUG
5020c8de5b0SBaptiste Daroussin if (yydebug)
5030c8de5b0SBaptiste Daroussin printf("%sdebug: state %d, error recovery shifting\
5040c8de5b0SBaptiste Daroussin to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
5050c8de5b0SBaptiste Daroussin #endif
506c5b5d71aSJung-uk Kim if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
5070c8de5b0SBaptiste Daroussin yystate = yytable[yyn];
5080c8de5b0SBaptiste Daroussin *++yystack.s_mark = yytable[yyn];
5090c8de5b0SBaptiste Daroussin *++yystack.l_mark = yylval;
5100c8de5b0SBaptiste Daroussin goto yyloop;
5110c8de5b0SBaptiste Daroussin }
5120c8de5b0SBaptiste Daroussin else
5130c8de5b0SBaptiste Daroussin {
5140c8de5b0SBaptiste Daroussin #if YYDEBUG
5150c8de5b0SBaptiste Daroussin if (yydebug)
5160c8de5b0SBaptiste Daroussin printf("%sdebug: error recovery discarding state %d\n",
5170c8de5b0SBaptiste Daroussin YYPREFIX, *yystack.s_mark);
5180c8de5b0SBaptiste Daroussin #endif
5190c8de5b0SBaptiste Daroussin if (yystack.s_mark <= yystack.s_base) goto yyabort;
5200c8de5b0SBaptiste Daroussin --yystack.s_mark;
5210c8de5b0SBaptiste Daroussin --yystack.l_mark;
5220c8de5b0SBaptiste Daroussin }
5230c8de5b0SBaptiste Daroussin }
5240c8de5b0SBaptiste Daroussin }
5250c8de5b0SBaptiste Daroussin else
5260c8de5b0SBaptiste Daroussin {
5270c8de5b0SBaptiste Daroussin if (yychar == YYEOF) goto yyabort;
5280c8de5b0SBaptiste Daroussin #if YYDEBUG
5290c8de5b0SBaptiste Daroussin if (yydebug)
5300c8de5b0SBaptiste Daroussin {
531c5b5d71aSJung-uk Kim if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
5320c8de5b0SBaptiste Daroussin printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
5330c8de5b0SBaptiste Daroussin YYPREFIX, yystate, yychar, yys);
5340c8de5b0SBaptiste Daroussin }
5350c8de5b0SBaptiste Daroussin #endif
5360c8de5b0SBaptiste Daroussin yychar = YYEMPTY;
5370c8de5b0SBaptiste Daroussin goto yyloop;
5380c8de5b0SBaptiste Daroussin }
5390c8de5b0SBaptiste Daroussin
5400c8de5b0SBaptiste Daroussin yyreduce:
5410c8de5b0SBaptiste Daroussin #if YYDEBUG
5420c8de5b0SBaptiste Daroussin if (yydebug)
5430c8de5b0SBaptiste Daroussin printf("%sdebug: state %d, reducing by rule %d (%s)\n",
5440c8de5b0SBaptiste Daroussin YYPREFIX, yystate, yyn, yyrule[yyn]);
5450c8de5b0SBaptiste Daroussin #endif
5460c8de5b0SBaptiste Daroussin yym = yylen[yyn];
547c5b5d71aSJung-uk Kim if (yym > 0)
5480c8de5b0SBaptiste Daroussin yyval = yystack.l_mark[1-yym];
5490c8de5b0SBaptiste Daroussin else
5500c8de5b0SBaptiste Daroussin memset(&yyval, 0, sizeof yyval);
551c5b5d71aSJung-uk Kim
5520c8de5b0SBaptiste Daroussin switch (yyn)
5530c8de5b0SBaptiste Daroussin {
5540c8de5b0SBaptiste Daroussin case 3:
5550c8de5b0SBaptiste Daroussin #line 28 "calc.y"
5560c8de5b0SBaptiste Daroussin { yyerrok ; }
557*8e022d3cSDag-Erling Smørgrav #line 558 "calc.tab.c"
5580c8de5b0SBaptiste Daroussin break;
5590c8de5b0SBaptiste Daroussin case 4:
5600c8de5b0SBaptiste Daroussin #line 32 "calc.y"
5610c8de5b0SBaptiste Daroussin { printf("%d\n",yystack.l_mark[0]);}
562*8e022d3cSDag-Erling Smørgrav #line 563 "calc.tab.c"
5630c8de5b0SBaptiste Daroussin break;
5640c8de5b0SBaptiste Daroussin case 5:
5650c8de5b0SBaptiste Daroussin #line 34 "calc.y"
5660c8de5b0SBaptiste Daroussin { regs[yystack.l_mark[-2]] = yystack.l_mark[0]; }
567*8e022d3cSDag-Erling Smørgrav #line 568 "calc.tab.c"
5680c8de5b0SBaptiste Daroussin break;
5690c8de5b0SBaptiste Daroussin case 6:
5700c8de5b0SBaptiste Daroussin #line 38 "calc.y"
5710c8de5b0SBaptiste Daroussin { yyval = yystack.l_mark[-1]; }
572*8e022d3cSDag-Erling Smørgrav #line 573 "calc.tab.c"
5730c8de5b0SBaptiste Daroussin break;
5740c8de5b0SBaptiste Daroussin case 7:
5750c8de5b0SBaptiste Daroussin #line 40 "calc.y"
5760c8de5b0SBaptiste Daroussin { yyval = yystack.l_mark[-2] + yystack.l_mark[0]; }
577*8e022d3cSDag-Erling Smørgrav #line 578 "calc.tab.c"
5780c8de5b0SBaptiste Daroussin break;
5790c8de5b0SBaptiste Daroussin case 8:
5800c8de5b0SBaptiste Daroussin #line 42 "calc.y"
5810c8de5b0SBaptiste Daroussin { yyval = yystack.l_mark[-2] - yystack.l_mark[0]; }
582*8e022d3cSDag-Erling Smørgrav #line 583 "calc.tab.c"
5830c8de5b0SBaptiste Daroussin break;
5840c8de5b0SBaptiste Daroussin case 9:
5850c8de5b0SBaptiste Daroussin #line 44 "calc.y"
5860c8de5b0SBaptiste Daroussin { yyval = yystack.l_mark[-2] * yystack.l_mark[0]; }
587*8e022d3cSDag-Erling Smørgrav #line 588 "calc.tab.c"
5880c8de5b0SBaptiste Daroussin break;
5890c8de5b0SBaptiste Daroussin case 10:
5900c8de5b0SBaptiste Daroussin #line 46 "calc.y"
5910c8de5b0SBaptiste Daroussin { yyval = yystack.l_mark[-2] / yystack.l_mark[0]; }
592*8e022d3cSDag-Erling Smørgrav #line 593 "calc.tab.c"
5930c8de5b0SBaptiste Daroussin break;
5940c8de5b0SBaptiste Daroussin case 11:
5950c8de5b0SBaptiste Daroussin #line 48 "calc.y"
5960c8de5b0SBaptiste Daroussin { yyval = yystack.l_mark[-2] % yystack.l_mark[0]; }
597*8e022d3cSDag-Erling Smørgrav #line 598 "calc.tab.c"
5980c8de5b0SBaptiste Daroussin break;
5990c8de5b0SBaptiste Daroussin case 12:
6000c8de5b0SBaptiste Daroussin #line 50 "calc.y"
6010c8de5b0SBaptiste Daroussin { yyval = yystack.l_mark[-2] & yystack.l_mark[0]; }
602*8e022d3cSDag-Erling Smørgrav #line 603 "calc.tab.c"
6030c8de5b0SBaptiste Daroussin break;
6040c8de5b0SBaptiste Daroussin case 13:
6050c8de5b0SBaptiste Daroussin #line 52 "calc.y"
6060c8de5b0SBaptiste Daroussin { yyval = yystack.l_mark[-2] | yystack.l_mark[0]; }
607*8e022d3cSDag-Erling Smørgrav #line 608 "calc.tab.c"
6080c8de5b0SBaptiste Daroussin break;
6090c8de5b0SBaptiste Daroussin case 14:
6100c8de5b0SBaptiste Daroussin #line 54 "calc.y"
6110c8de5b0SBaptiste Daroussin { yyval = - yystack.l_mark[0]; }
612*8e022d3cSDag-Erling Smørgrav #line 613 "calc.tab.c"
6130c8de5b0SBaptiste Daroussin break;
6140c8de5b0SBaptiste Daroussin case 15:
6150c8de5b0SBaptiste Daroussin #line 56 "calc.y"
6160c8de5b0SBaptiste Daroussin { yyval = regs[yystack.l_mark[0]]; }
617*8e022d3cSDag-Erling Smørgrav #line 618 "calc.tab.c"
6180c8de5b0SBaptiste Daroussin break;
6190c8de5b0SBaptiste Daroussin case 17:
6200c8de5b0SBaptiste Daroussin #line 61 "calc.y"
6210c8de5b0SBaptiste Daroussin { yyval = yystack.l_mark[0]; base = (yystack.l_mark[0]==0) ? 8 : 10; }
622*8e022d3cSDag-Erling Smørgrav #line 623 "calc.tab.c"
6230c8de5b0SBaptiste Daroussin break;
6240c8de5b0SBaptiste Daroussin case 18:
6250c8de5b0SBaptiste Daroussin #line 63 "calc.y"
6260c8de5b0SBaptiste Daroussin { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
627*8e022d3cSDag-Erling Smørgrav #line 628 "calc.tab.c"
6280c8de5b0SBaptiste Daroussin break;
629*8e022d3cSDag-Erling Smørgrav #line 630 "calc.tab.c"
6300c8de5b0SBaptiste Daroussin }
6310c8de5b0SBaptiste Daroussin yystack.s_mark -= yym;
6320c8de5b0SBaptiste Daroussin yystate = *yystack.s_mark;
6330c8de5b0SBaptiste Daroussin yystack.l_mark -= yym;
6340c8de5b0SBaptiste Daroussin yym = yylhs[yyn];
6350c8de5b0SBaptiste Daroussin if (yystate == 0 && yym == 0)
6360c8de5b0SBaptiste Daroussin {
6370c8de5b0SBaptiste Daroussin #if YYDEBUG
6380c8de5b0SBaptiste Daroussin if (yydebug)
6390c8de5b0SBaptiste Daroussin printf("%sdebug: after reduction, shifting from state 0 to\
6400c8de5b0SBaptiste Daroussin state %d\n", YYPREFIX, YYFINAL);
6410c8de5b0SBaptiste Daroussin #endif
6420c8de5b0SBaptiste Daroussin yystate = YYFINAL;
6430c8de5b0SBaptiste Daroussin *++yystack.s_mark = YYFINAL;
6440c8de5b0SBaptiste Daroussin *++yystack.l_mark = yyval;
6450c8de5b0SBaptiste Daroussin if (yychar < 0)
6460c8de5b0SBaptiste Daroussin {
647c5b5d71aSJung-uk Kim yychar = YYLEX;
648c5b5d71aSJung-uk Kim if (yychar < 0) yychar = YYEOF;
6490c8de5b0SBaptiste Daroussin #if YYDEBUG
6500c8de5b0SBaptiste Daroussin if (yydebug)
6510c8de5b0SBaptiste Daroussin {
652c5b5d71aSJung-uk Kim if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
6530c8de5b0SBaptiste Daroussin printf("%sdebug: state %d, reading %d (%s)\n",
6540c8de5b0SBaptiste Daroussin YYPREFIX, YYFINAL, yychar, yys);
6550c8de5b0SBaptiste Daroussin }
6560c8de5b0SBaptiste Daroussin #endif
6570c8de5b0SBaptiste Daroussin }
6580c8de5b0SBaptiste Daroussin if (yychar == YYEOF) goto yyaccept;
6590c8de5b0SBaptiste Daroussin goto yyloop;
6600c8de5b0SBaptiste Daroussin }
661c5b5d71aSJung-uk Kim if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
662c5b5d71aSJung-uk Kim yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
6630c8de5b0SBaptiste Daroussin yystate = yytable[yyn];
6640c8de5b0SBaptiste Daroussin else
6650c8de5b0SBaptiste Daroussin yystate = yydgoto[yym];
6660c8de5b0SBaptiste Daroussin #if YYDEBUG
6670c8de5b0SBaptiste Daroussin if (yydebug)
6680c8de5b0SBaptiste Daroussin printf("%sdebug: after reduction, shifting from state %d \
6690c8de5b0SBaptiste Daroussin to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
6700c8de5b0SBaptiste Daroussin #endif
671c5b5d71aSJung-uk Kim if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
6720c8de5b0SBaptiste Daroussin *++yystack.s_mark = (YYINT) yystate;
6730c8de5b0SBaptiste Daroussin *++yystack.l_mark = yyval;
6740c8de5b0SBaptiste Daroussin goto yyloop;
6750c8de5b0SBaptiste Daroussin
6760c8de5b0SBaptiste Daroussin yyoverflow:
6770c8de5b0SBaptiste Daroussin YYERROR_CALL("yacc stack overflow");
6780c8de5b0SBaptiste Daroussin
6790c8de5b0SBaptiste Daroussin yyabort:
6800c8de5b0SBaptiste Daroussin yyfreestack(&yystack);
6810c8de5b0SBaptiste Daroussin return (1);
6820c8de5b0SBaptiste Daroussin
6830c8de5b0SBaptiste Daroussin yyaccept:
6840c8de5b0SBaptiste Daroussin yyfreestack(&yystack);
6850c8de5b0SBaptiste Daroussin return (0);
6860c8de5b0SBaptiste Daroussin }
687