?? y.tab.c
字號:
/* A Bison parser, made from y.y
by GNU Bison version 1.28 */
#define YYBISON 1 /* Identify Bison output. */
#define VOID 257
#define INT 258
#define CHAR 259
#define RETURN 260
#define IF 261
#define ELSE 262
#define WHILE 263
#define ID 264
#define NUMBER 265
#define RELOP 266
#define LIMOP 267
#define CHART 268
#define STRING 269
#line 1 "y.y"
/* YACC -- LALR(1) PARSER */
/* Sub-set of C Language */
#include <stdio.h>
#include <stdlib.h>
#include "y.tab.h"
extern FILE *yyin;
FILE *out;
extern int yylex();
extern void yyerror(const char *msg);
#ifndef YYSTYPE
#define YYSTYPE int
#endif
#include <stdio.h>
#ifndef __cplusplus
#ifndef __STDC__
#define const
#endif
#endif
#define YYFINAL 97
#define YYFLAG -32768
#define YYNTBASE 29
#define YYTRANSLATE(x) ((unsigned)(x) <= 269 ? yytranslate[x] : 57)
static const char yytranslate[] = { 0,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 23,
24, 18, 16, 25, 17, 2, 19, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 20, 2,
28, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
21, 2, 22, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 26, 2, 27, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
7, 8, 9, 10, 11, 12, 13, 14, 15
};
#if YYDEBUG != 0
static const short yyprhs[] = { 0,
0, 2, 5, 7, 9, 11, 15, 22, 24, 26,
33, 40, 42, 44, 48, 50, 53, 58, 63, 66,
67, 70, 71, 73, 75, 77, 79, 81, 84, 86,
92, 100, 106, 109, 113, 117, 119, 121, 126, 130,
132, 136, 138, 140, 142, 146, 148, 150, 152, 156,
158, 160, 162, 167, 169, 170, 174
};
static const short yyrhs[] = { 30,
0, 30, 31, 0, 31, 0, 32, 0, 34, 0,
33, 10, 20, 0, 33, 10, 21, 11, 22, 20,
0, 4, 0, 3, 0, 33, 10, 23, 35, 24,
38, 0, 33, 10, 23, 35, 24, 20, 0, 36,
0, 3, 0, 36, 25, 37, 0, 37, 0, 33,
10, 0, 33, 10, 21, 22, 0, 26, 39, 40,
27, 0, 39, 32, 0, 0, 40, 41, 0, 0,
42, 0, 38, 0, 43, 0, 44, 0, 45, 0,
46, 20, 0, 20, 0, 7, 23, 46, 24, 41,
0, 7, 23, 46, 24, 41, 8, 41, 0, 9,
23, 46, 24, 41, 0, 6, 20, 0, 6, 46,
20, 0, 47, 28, 46, 0, 48, 0, 10, 0,
10, 21, 46, 22, 0, 49, 12, 49, 0, 49,
0, 49, 50, 51, 0, 51, 0, 16, 0, 17,
0, 51, 52, 53, 0, 53, 0, 18, 0, 19,
0, 23, 46, 24, 0, 47, 0, 54, 0, 11,
0, 10, 23, 55, 24, 0, 56, 0, 0, 56,
25, 46, 0, 46, 0
};
#endif
#if YYDEBUG != 0
static const short yyrline[] = { 0,
26, 28, 29, 31, 32, 34, 35, 37, 38, 40,
41, 43, 44, 46, 47, 49, 50, 52, 54, 55,
57, 58, 60, 61, 62, 63, 64, 66, 67, 69,
70, 72, 74, 75, 77, 78, 80, 81, 83, 84,
86, 87, 89, 90, 92, 93, 95, 96, 98, 99,
100, 101, 103, 105, 106, 108, 109
};
#endif
#if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
static const char * const yytname[] = { "$","error","$undefined.","VOID","INT",
"CHAR","RETURN","IF","ELSE","WHILE","ID","NUMBER","RELOP","LIMOP","CHART","STRING",
"'+'","'-'","'*'","'/'","';'","'['","']'","'('","')'","','","'{'","'}'","'='",
"program","declaration_list","declaration","var_declaration","type_specifer",
"fun_declaration","params","param_list","param","compound_stmt","local_declarations",
"statement_list","statement","expression_stmt","if_stmt","while_stmt","return_stmt",
"expression","var","simple_expression","additive_expression","addop","term",
"mulop","factor","call","args","arg_list", NULL
};
#endif
static const short yyr1[] = { 0,
29, 30, 30, 31, 31, 32, 32, 33, 33, 34,
34, 35, 35, 36, 36, 37, 37, 38, 39, 39,
40, 40, 41, 41, 41, 41, 41, 42, 42, 43,
43, 44, 45, 45, 46, 46, 47, 47, 48, 48,
49, 49, 50, 50, 51, 51, 52, 52, 53, 53,
53, 53, 54, 55, 55, 56, 56
};
static const short yyr2[] = { 0,
1, 2, 1, 1, 1, 3, 6, 1, 1, 6,
6, 1, 1, 3, 1, 2, 4, 4, 2, 0,
2, 0, 1, 1, 1, 1, 1, 2, 1, 5,
7, 5, 2, 3, 3, 1, 1, 4, 3, 1,
3, 1, 1, 1, 3, 1, 1, 1, 3, 1,
1, 1, 4, 1, 0, 3, 1
};
static const short yydefact[] = { 0,
9, 8, 1, 3, 4, 0, 5, 2, 0, 6,
0, 0, 0, 9, 0, 0, 12, 15, 0, 16,
0, 0, 7, 0, 11, 20, 10, 14, 17, 22,
19, 0, 0, 0, 0, 0, 0, 37, 52, 29,
0, 18, 24, 21, 23, 25, 26, 27, 0, 50,
36, 40, 42, 46, 51, 33, 0, 0, 0, 0,
55, 0, 28, 0, 0, 43, 44, 0, 47, 48,
0, 34, 0, 0, 0, 57, 0, 54, 49, 35,
50, 39, 41, 45, 0, 0, 38, 53, 0, 30,
32, 56, 0, 31, 0, 0, 0
};
static const short yydefgoto[] = { 95,
3, 4, 5, 6, 7, 16, 17, 18, 43, 30,
33, 44, 45, 46, 47, 48, 49, 50, 51, 52,
68, 53, 71, 54, 55, 77, 78
};
static const short yypact[] = { 18,
-32768,-32768, 18,-32768,-32768, -5,-32768,-32768, 25,-32768,
-2, 28, 6, 13, 58, 27, 31,-32768, 40, 48,
-16, 18,-32768, 49,-32768,-32768,-32768,-32768,-32768, 18,
-32768, 60, 7, 42, -8, 51, 52, 38,-32768,-32768,
-3,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 53, 44,
-32768, 41, 46,-32768,-32768,-32768, 56, -3, -3, -3,
-3, 54,-32768, -3, -3,-32768,-32768, -3,-32768,-32768,
-3,-32768, 55, 57, 61,-32768, 62, 59,-32768,-32768,
-32768, 50, 46,-32768, 29, 29,-32768,-32768, -3, 69,
-32768,-32768, 29,-32768, 80, 82,-32768
};
static const short yypgoto[] = {-32768,
-32768, 84, 63, -11,-32768,-32768,-32768, 66, 64,-32768,
-32768, -43,-32768,-32768,-32768,-32768, -35, -24,-32768, 24,
-32768, 22,-32768, 20,-32768,-32768,-32768
};
#define YYLAST 93
static const short yytable[] = { 57,
15, 38, 39, 25, 9, 62, 38, 39, 13, 26,
15, 56, 35, 36, 41, 37, 38, 39, 32, 41,
1, 2, 73, 74, 75, 76, 40, 19, 80, 41,
14, 2, 26, 42, 35, 36, -13, 37, 38, 39,
81, 90, 91, 81, 10, 11, 81, 12, 40, 94,
21, 41, 65, 92, 26, 22, 66, 67, 60, 23,
61, 10, 11, 69, 70, 66, 67, 20, 24, 34,
29, 64, 63, 58, 59, 72, 93, 79, 85, 96,
86, 97, 87, 89, 27, 88, 8, 28, 82, 83,
84, 0, 31
};
static const short yycheck[] = { 35,
12, 10, 11, 20, 10, 41, 10, 11, 11, 26,
22, 20, 6, 7, 23, 9, 10, 11, 30, 23,
3, 4, 58, 59, 60, 61, 20, 22, 64, 23,
3, 4, 26, 27, 6, 7, 24, 9, 10, 11,
65, 85, 86, 68, 20, 21, 71, 23, 20, 93,
24, 23, 12, 89, 26, 25, 16, 17, 21, 20,
23, 20, 21, 18, 19, 16, 17, 10, 21, 10,
22, 28, 20, 23, 23, 20, 8, 24, 24, 0,
24, 0, 22, 25, 21, 24, 3, 22, 65, 68,
71, -1, 30
};
/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
#line 3 "/usr/local/share/bison.simple"
/* This file comes from bison-1.28. */
/* Skeleton output parser for bison,
Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* As a special exception, when this file is copied by Bison into a
Bison output file, you may use that output file without restriction.
This special exception was added by the Free Software Foundation
in version 1.24 of Bison. */
/* This is the parser code that is written into each bison parser
when the %semantic_parser declaration is not specified in the grammar.
It was written by Richard Stallman by simplifying the hairy parser
used when %semantic_parser is specified. */
#ifndef YYSTACK_USE_ALLOCA
#ifdef alloca
#define YYSTACK_USE_ALLOCA
#else /* alloca not defined */
#ifdef __GNUC__
#define YYSTACK_USE_ALLOCA
#define alloca __builtin_alloca
#else /* not GNU C. */
#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
#define YYSTACK_USE_ALLOCA
#include <alloca.h>
#else /* not sparc */
/* We think this test detects Watcom and Microsoft C. */
/* This used to test MSDOS, but that is a bad idea
since that symbol is in the user namespace. */
#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
#if 0 /* No need for malloc.h, which pollutes the namespace;
instead, just don't use alloca. */
#include <malloc.h>
#endif
#else /* not MSDOS, or __TURBOC__ */
#if defined(_AIX)
/* I don't know what this was needed for, but it pollutes the namespace.
So I turned it off. rms, 2 May 1997. */
/* #include <malloc.h> */
#pragma alloca
#define YYSTACK_USE_ALLOCA
#else /* not MSDOS, or __TURBOC__, or _AIX */
#if 0
#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
and on HPUX 10. Eventually we can turn this on. */
#define YYSTACK_USE_ALLOCA
#define alloca __builtin_alloca
#endif /* __hpux */
#endif
#endif /* not _AIX */
#endif /* not MSDOS, or __TURBOC__ */
#endif /* not sparc */
#endif /* not GNU C */
#endif /* alloca not defined */
#endif /* YYSTACK_USE_ALLOCA not defined */
#ifdef YYSTACK_USE_ALLOCA
#define YYSTACK_ALLOC alloca
#else
#define YYSTACK_ALLOC malloc
#endif
/* Note: there must be only one dollar sign in this file.
It is replaced by the list of actions, each action
as one case of the switch. */
#define yyerrok (yyerrstatus = 0)
#define yyclearin (yychar = YYEMPTY)
#define YYEMPTY -2
#define YYEOF 0
#define YYACCEPT goto yyacceptlab
#define YYABORT goto yyabortlab
#define YYERROR goto yyerrlab1
/* Like YYERROR except do call yyerror.
This remains here temporarily to ease the
transition to the new meaning of YYERROR, for GCC.
Once GCC version 2 has supplanted version 1, this can go. */
#define YYFAIL goto yyerrlab
#define YYRECOVERING() (!!yyerrstatus)
#define YYBACKUP(token, value) \
do \
if (yychar == YYEMPTY && yylen == 1) \
{ yychar = (token), yylval = (value); \
yychar1 = YYTRANSLATE (yychar); \
YYPOPSTACK; \
goto yybackup; \
} \
else \
{ yyerror ("syntax error: cannot back up"); YYERROR; } \
while (0)
#define YYTERROR 1
#define YYERRCODE 256
#ifndef YYPURE
#define YYLEX yylex()
#endif
#ifdef YYPURE
#ifdef YYLSP_NEEDED
#ifdef YYLEX_PARAM
#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
#else
#define YYLEX yylex(&yylval, &yylloc)
#endif
#else /* not YYLSP_NEEDED */
#ifdef YYLEX_PARAM
#define YYLEX yylex(&yylval, YYLEX_PARAM)
#else
#define YYLEX yylex(&yylval)
#endif
#endif /* not YYLSP_NEEDED */
#endif
/* If nonreentrant, generate the variables here */
#ifndef YYPURE
int yychar; /* the lookahead symbol */
YYSTYPE yylval; /* the semantic value of the */
/* lookahead symbol */
#ifdef YYLSP_NEEDED
YYLTYPE yylloc; /* location data for the lookahead */
/* symbol */
#endif
int yynerrs; /* number of parse errors so far */
#endif /* not YYPURE */
#if YYDEBUG != 0
int yydebug; /* nonzero means print parse trace */
/* Since this is uninitialized, it does not stop multiple parsers
from coexisting. */
#endif
/* YYINITDEPTH indicates the initial size of the parser's stacks */
#ifndef YYINITDEPTH
#define YYINITDEPTH 200
#endif
/* YYMAXDEPTH is the maximum size the stacks can grow to
(effective only if the built-in stack extension method is used). */
#if YYMAXDEPTH == 0
#undef YYMAXDEPTH
#endif
#ifndef YYMAXDEPTH
#define YYMAXDEPTH 10000
#endif
/* Define __yy_memcpy. Note that the size argument
should be passed with type unsigned int, because that is what the non-GCC
definitions require. With GCC, __builtin_memcpy takes an arg
of type size_t, but it can handle unsigned int. */
#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
#else /* not GNU C or C++ */
#ifndef __cplusplus
/* This is the most reliable way to avoid incompatibilities
in available built-in functions on various systems. */
static void
__yy_memcpy (to, from, count)
char *to;
char *from;
unsigned int count;
{
register char *f = from;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -