📄 myyacc.tab.c
字号:
/* A Bison parser, made from myYacc.y
by GNU Bison version 1.25
*/
#define YYBISON 1 /* Identify Bison output. */
#define alloca
#define INUMBER 258
#define FNUMBER 259
#define ID 260
#define AND 261
#define OR 262
#define NOT 263
#define K_WHILE 264
#define K_DO 265
#define K_BEGIN 266
#define K_END 267
#define UMINUS 268
#line 1 "myYacc.y"
#include <ctype.h>
#include <stdio.h>
#include <string.h>
#define MSDOS
int linesCount;
int nextStat=0;
extern int yylex();
extern int yyerror();
extern char yytext[];
extern char lexeme[30];
extern char lexlogic[30];
extern char lexkey[30];
struct lexvalStack
{
union lex{ /*文法符号的属性值*/
char chr;
char *str;
int integer;
float real;
double dbl;
}lexValue;
char name[30];
char type;
};
struct lexvalStack tempVal,prevTempVal;
int tempVarCount=0;
void gen(char *opr,char *arg1,char *arg2);
void genjump(char *opr,int a,int b,char *arg);
void genrelation(char *opr,char *arg1,char *arg2,int next);
struct CSiYuan
{
char m_op[30];
char m_arg1[30];
char m_arg2[30];
char m_arg3[30];
};
struct CSiYuan JiLu[100];
int nCurrentPosition=0;
int rem_bool[30];
int rem_exit[30];
int nCurrentXunhuan=-1;
#line 47 "myYacc.y"
typedef union{ /*单词值*/
char chr;
char *str;
int integer;
float real;
double dbl;
char name[30];
struct lexvalStack lexeme;
} YYSTYPE;
#include <stdio.h>
#ifndef __cplusplus
#ifndef __STDC__
#define const
#endif
#endif
#define YYFINAL 54
#define YYFLAG 32768
#define YYNTBASE 27
#define YYTRANSLATE(x) ((unsigned)(x) <= 268 ? yytranslate[x] : 33)
static const char yytranslate[] = { 0,
2, 2, 2, 2, 2, 2, 2, 2, 2, 24,
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, 25,
26, 18, 16, 2, 17, 2, 19, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 23, 15,
13, 14, 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, 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, 2, 2, 2, 1, 2, 3, 4, 5,
6, 7, 8, 9, 10, 11, 12, 20
};
#if YYDEBUG != 0
static const short yyprhs[] = { 0,
0, 3, 5, 9, 12, 15, 19, 23, 27, 31,
35, 39, 43, 47, 50, 52, 54, 56, 60, 64,
67, 72, 75, 83, 86
};
static const short yyrhs[] = { 28,
23, 0, 32, 0, 27, 28, 23, 0, 27, 32,
0, 27, 24, 0, 28, 16, 28, 0, 28, 17,
28, 0, 28, 18, 28, 0, 28, 19, 28, 0,
28, 13, 28, 0, 28, 14, 28, 0, 28, 15,
28, 0, 25, 28, 26, 0, 17, 28, 0, 3,
0, 4, 0, 5, 0, 28, 6, 28, 0, 28,
7, 28, 0, 8, 28, 0, 28, 21, 28, 22,
0, 9, 25, 0, 29, 28, 26, 10, 24, 11,
24, 0, 30, 27, 0, 31, 12, 0
};
#endif
#if YYDEBUG != 0
static const short yyrline[] = { 0,
70, 74, 77, 80, 83, 87, 92, 97, 102, 107,
113, 129, 145, 149, 154, 158, 162, 166, 171, 176,
181, 193, 199, 210, 214
};
#endif
#if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
static const char * const yytname[] = { "$","error","$undefined.","INUMBER",
"FNUMBER","ID","AND","OR","NOT","K_WHILE","K_DO","K_BEGIN","K_END","'='","'>'",
"'<'","'+'","'-'","'*'","'/'","UMINUS","'['","']'","';'","'\\n'","'('","')'",
"sentence","expr","w1","w2","w3","w4", NULL
};
#endif
static const short yyr1[] = { 0,
27, 27, 27, 27, 27, 28, 28, 28, 28, 28,
28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
28, 29, 30, 31, 32
};
static const short yyr2[] = { 0,
2, 1, 3, 2, 2, 3, 3, 3, 3, 3,
3, 3, 3, 2, 1, 1, 1, 3, 3, 2,
4, 2, 7, 2, 2
};
static const short yydefact[] = { 0,
15, 16, 17, 0, 0, 0, 0, 0, 0, 0,
0, 0, 2, 20, 22, 14, 0, 5, 0, 4,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 0, 24, 25, 13, 3, 18, 19, 10, 11,
12, 6, 7, 8, 9, 0, 0, 21, 0, 0,
0, 23, 0, 0
};
static const short yydefgoto[] = { 8,
9, 10, 11, 12, 13
};
static const short yypact[] = { 55,
-32768,-32768,-32768, 62, -20, 62, 62, 27, 107, 62,
55, 3,-32768, 168,-32768, -14, 75,-32768, 125,-32768,
62, 62, 62, 62, 62, 62, 62, 62, 62, 62,
-32768, 91, 37,-32768,-32768,-32768, 168, -5, 160, 57,
57, 29, 29, -14, -14, 143, 18,-32768, 10, 26,
14,-32768, 39,-32768
};
static const short yypgoto[] = { 32,
-4,-32768,-32768,-32768, 0
};
#define YYLAST 189
static const short yytable[] = { 14,
21, 16, 17, 19, 15, 32, 30, 20, 24, 25,
26, 27, 28, 29, 34, 30, 37, 38, 39, 40,
41, 42, 43, 44, 45, 46, 53, 49, 19, 1,
2, 3, 20, 50, 4, 5, 51, 52, 54, 1,
2, 3, 33, 6, 4, 5, 28, 29, 0, 30,
18, 7, 0, 6, 0, 0, 0, 1, 2, 3,
18, 7, 4, 5, 1, 2, 3, 0, 0, 4,
0, 6, 26, 27, 28, 29, 0, 30, 6, 7,
21, 22, 0, 0, 0, 0, 7, 23, 24, 25,
26, 27, 28, 29, 0, 30, 21, 22, 0, 0,
35, 0, 0, 23, 24, 25, 26, 27, 28, 29,
0, 30, 21, 22, 0, 0, 47, 0, 0, 23,
24, 25, 26, 27, 28, 29, 0, 30, 0, 31,
21, 22, 0, 0, 0, 0, 0, 23, 24, 25,
26, 27, 28, 29, 0, 30, 0, 36, 21, 22,
0, 0, 0, 0, 0, 23, 24, 25, 26, 27,
28, 29, 0, 30, 48, 21, 22, 0, 0, 0,
0, 0, 23, 24, 25, 26, 27, 28, 29, 0,
30, 24, 25, 26, 27, 28, 29, 0, 30
};
static const short yycheck[] = { 4,
6, 6, 7, 8, 25, 10, 21, 8, 14, 15,
16, 17, 18, 19, 12, 21, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 0, 10, 33, 3,
4, 5, 33, 24, 8, 9, 11, 24, 0, 3,
4, 5, 11, 17, 8, 9, 18, 19, -1, 21,
24, 25, -1, 17, -1, -1, -1, 3, 4, 5,
24, 25, 8, 9, 3, 4, 5, -1, -1, 8,
-1, 17, 16, 17, 18, 19, -1, 21, 17, 25,
6, 7, -1, -1, -1, -1, 25, 13, 14, 15,
16, 17, 18, 19, -1, 21, 6, 7, -1, -1,
26, -1, -1, 13, 14, 15, 16, 17, 18, 19,
-1, 21, 6, 7, -1, -1, 26, -1, -1, 13,
14, 15, 16, 17, 18, 19, -1, 21, -1, 23,
6, 7, -1, -1, -1, -1, -1, 13, 14, 15,
16, 17, 18, 19, -1, 21, -1, 23, 6, 7,
-1, -1, -1, -1, -1, 13, 14, 15, 16, 17,
18, 19, -1, 21, 22, 6, 7, -1, -1, -1,
-1, -1, 13, 14, 15, 16, 17, 18, 19, -1,
21, 14, 15, 16, 17, 18, 19, -1, 21
};
/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
/* 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., 675 Mass Ave, Cambridge, MA 02139, 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. */
#ifndef alloca
#ifdef __GNUC__
#define alloca __builtin_alloca
#else /* not GNU C. */
#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
#include <alloca.h>
#else /* not sparc */
#if defined (MSDOS) && !defined (__TURBOC__)
#include <malloc.h>
#else /* not MSDOS, or __TURBOC__ */
#if defined(_AIX)
#include <malloc.h>
#pragma alloca
#else /* not MSDOS, __TURBOC__, or _AIX */
#ifdef __hpux
#ifdef __cplusplus
extern "C" {
void *alloca (unsigned int);
};
#else /* not __cplusplus */
void *alloca ();
#endif /* not __cplusplus */
#endif /* __hpux */
#endif /* not _AIX */
#endif /* not MSDOS, or __TURBOC__ */
#endif /* not sparc. */
#endif /* not GNU C. */
#endif /* alloca not defined. */
/* 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. */
/* 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 return(0)
#define YYABORT return(1)
#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
/* Prevent warning if -Wstrict-prototypes. */
#ifdef __GNUC__
int yyparse (void);
#endif
#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -