📄 checker.tab.c.bak
字号:
/* A Bison parser, made by GNU Bison 1.875. */
/* Skeleton parser for Yacc-like parsing with Bison,
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 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. */
/* Written by Richard Stallman by simplifying the original so called
``semantic'' parser. */
/* All symbols defined below should begin with yy or YY, to avoid
infringing on user name space. This should be done even for local
variables, as they might otherwise be expanded by user macros.
There are some unavoidable exceptions within include files to
define necessary library symbols; they are noted "INFRINGES ON
USER NAME SPACE" below. */
/* Identify Bison output. */
#define YYBISON 1
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
/* Pure parsers. */
#define YYPURE 0
/* Using locations. */
#define YYLSP_NEEDED 0
/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
enum yytokentype {
NIL = 258,
IDENT = 259,
TRUE = 260,
FALSE = 261,
INT = 262,
SYMNULL = 263,
CHAR = 264,
DOUBLE = 265,
STRING = 266,
IF = 267,
ELSE = 268,
FOR = 269,
WHILE = 270,
BREAK = 271,
RETURN = 272,
PRINT = 273,
READINT = 274,
READDBL = 275,
READLINE = 276,
NEW = 277,
LPAREN = 278,
RPAREN = 279,
LBRACKET = 280,
RBRACKET = 281,
LSQUARE = 282,
RSQUARE = 283,
DOT = 284,
COMMA = 285,
SEMICOLON = 286,
TYPEINT = 287,
TYPEDOUBLE = 288,
TYPEBOOL = 289,
TYPESTRING = 290,
TYPEVOID = 291,
TYPECHAR = 292,
CLASS = 293,
EXTENDS = 294,
THIS = 295,
STRUCT = 296,
CONST = 297,
READREG = 298,
WRITEREG = 299,
ASM = 300,
LET = 301,
LOGICOR = 302,
LOGICAND = 303,
NEQ = 304,
EQL = 305,
GEQ = 306,
LEQ = 307,
GTR = 308,
LES = 309,
OR = 310,
CALCNOT = 311,
SHR = 312,
SHL = 313,
XOR = 314,
AND = 315,
MINUS = 316,
ADD = 317,
MOD = 318,
DIV = 319,
MUL = 320,
FORCE = 321,
REF = 322,
STAR = 323,
NOT = 324,
UMINUS = 325,
MMINUS = 326,
PPLUS = 327,
IFX = 328
};
#endif
#define NIL 258
#define IDENT 259
#define TRUE 260
#define FALSE 261
#define INT 262
#define SYMNULL 263
#define CHAR 264
#define DOUBLE 265
#define STRING 266
#define IF 267
#define ELSE 268
#define FOR 269
#define WHILE 270
#define BREAK 271
#define RETURN 272
#define PRINT 273
#define READINT 274
#define READDBL 275
#define READLINE 276
#define NEW 277
#define LPAREN 278
#define RPAREN 279
#define LBRACKET 280
#define RBRACKET 281
#define LSQUARE 282
#define RSQUARE 283
#define DOT 284
#define COMMA 285
#define SEMICOLON 286
#define TYPEINT 287
#define TYPEDOUBLE 288
#define TYPEBOOL 289
#define TYPESTRING 290
#define TYPEVOID 291
#define TYPECHAR 292
#define CLASS 293
#define EXTENDS 294
#define THIS 295
#define STRUCT 296
#define CONST 297
#define READREG 298
#define WRITEREG 299
#define ASM 300
#define LET 301
#define LOGICOR 302
#define LOGICAND 303
#define NEQ 304
#define EQL 305
#define GEQ 306
#define LEQ 307
#define GTR 308
#define LES 309
#define OR 310
#define CALCNOT 311
#define SHR 312
#define SHL 313
#define XOR 314
#define AND 315
#define MINUS 316
#define ADD 317
#define MOD 318
#define DIV 319
#define MUL 320
#define FORCE 321
#define REF 322
#define STAR 323
#define NOT 324
#define UMINUS 325
#define MMINUS 326
#define PPLUS 327
#define IFX 328
/* Copy the first part of user declarations. */
#line 1 "checker.y"
#include <string>
#include <cstdlib>
#include <cstdio>
#include <iostream>
#include <vector>
#include <list>
#include "CHKsupport.cpp"
using namespace std;
struct __yystype {
int intval;
list <int> int_list;
string strval;
list <TSymbolListVariableEntry> Ventry_list;
TSymbolListVariableEntry Ventry;
TSymbolListTypeEntry Tentry;
TSymbolListFunctionEntry Fentry;
};
extern int PROGRAM_EOF;
extern int PROGRAM_LineNumber;
extern char* PROGRAM_FileName;
#define YYSTYPE __yystype
int yyerror(string msg)
{
Tmsg tmpmsg;
tmpmsg.lineno = PROGRAM_LineNumber;
if (PROGRAM_EOF)
{
tmpmsg.msgtxt = "1: " + msg + " before *end of file*";
}
else
{
tmpmsg.msgtxt = "1: " + msg + " before \"" + yytext + "\"";
}
tmpmsg.sourcecount = error_msgs.size();
error_msgs.push_back(tmpmsg);
return 0;
}
int yylex();
int InFuncLevel = -1;
int InLoopCount = 0;
int PROGRAM_func_ret;
/* Enabling traces. */
#ifndef YYDEBUG
# define YYDEBUG 0
#endif
/* Enabling verbose error messages. */
#ifdef YYERROR_VERBOSE
# undef YYERROR_VERBOSE
# define YYERROR_VERBOSE 1
#else
# define YYERROR_VERBOSE 0
#endif
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
typedef int YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1
#endif
/* Copy the second part of user declarations. */
/* Line 214 of yacc.c. */
#line 286 "checker.tab.c"
#if ! defined (yyoverflow) || YYERROR_VERBOSE
/* The parser invokes alloca or malloc; define the necessary symbols. */
# if YYSTACK_USE_ALLOCA
# define YYSTACK_ALLOC alloca
# else
# ifndef YYSTACK_USE_ALLOCA
# if defined (alloca) || defined (_ALLOCA_H)
# define YYSTACK_ALLOC alloca
# else
# ifdef __GNUC__
# define YYSTACK_ALLOC __builtin_alloca
# endif
# endif
# endif
# endif
# ifdef YYSTACK_ALLOC
/* Pacify GCC's `empty if-body' warning. */
# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
# else
# if defined (__STDC__) || defined (__cplusplus)
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
# define YYSIZE_T size_t
# endif
# define YYSTACK_ALLOC malloc
# define YYSTACK_FREE free
# endif
#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
#if (! defined (yyoverflow) \
&& (! defined (__cplusplus) \
|| (YYSTYPE_IS_TRIVIAL)))
/* A type that is properly aligned for any stack member. */
union yyalloc
{
short yyss;
YYSTYPE yyvs;
};
/* The size of the maximum gap between one aligned stack and the next. */
# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
/* The size of an array large to enough to hold all stacks, each with
N elements. */
# define YYSTACK_BYTES(N) \
((N) * (sizeof (short) + sizeof (YYSTYPE)) \
+ YYSTACK_GAP_MAXIMUM)
/* Copy COUNT objects from FROM to TO. The source and destination do
not overlap. */
# ifndef YYCOPY
# if 1 < __GNUC__
# define YYCOPY(To, From, Count) \
__builtin_memcpy (To, From, (Count) * sizeof (*(From)))
# else
# define YYCOPY(To, From, Count) \
do \
{ \
register YYSIZE_T yyi; \
for (yyi = 0; yyi < (Count); yyi++) \
(To)[yyi] = (From)[yyi]; \
} \
while (0)
# endif
# endif
/* Relocate STACK from its old location to the new one. The
local variables YYSIZE and YYSTACKSIZE give the old and new number of
elements in the stack, and YYPTR gives the new location of the
stack. Advance YYPTR to a properly aligned location for the next
stack. */
# define YYSTACK_RELOCATE(Stack) \
do \
{ \
YYSIZE_T yynewbytes; \
YYCOPY (&yyptr->Stack, Stack, yysize); \
Stack = &yyptr->Stack; \
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
yyptr += yynewbytes / sizeof (*yyptr); \
} \
while (0)
#endif
#if defined (__STDC__) || defined (__cplusplus)
typedef signed char yysigned_char;
#else
typedef short yysigned_char;
#endif
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 20
/* YYLAST -- Last index in YYTABLE. */
#define YYLAST 787
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -