/****************************************************************************
* U N R E G I S T E R E D C O P Y
*
* You are on day 4 of your 30 day trial period.
*
* This file was produced by an UNREGISTERED COPY of Parser Generator. It is
* for evaluation purposes only. If you continue to use Parser Generator 30
* days after installation then you are required to purchase a license. For
* more information see the online help or go to the Bumble-Bee Software
* homepage at:
*
* http://www.bumblebeesoftware.com
*
* This notice must remain present in the file. It cannot be removed.
****************************************************************************/
/****************************************************************************
* myparser.c
* C source file generated from myparser.y.
*
* Date: 10/21/18
* Time: 23:50:11
*
* AYACC Version: 2.07
****************************************************************************/
#include <yypars.h>
/* namespaces */
#if defined(__cplusplus) && defined(YYSTDCPPLIB)
using namespace std;
#endif
#if defined(__cplusplus) && defined(YYNAMESPACE)
using namespace yl;
#endif
#define YYFASTPARSER
#line 1 ".\\myparser.y"
/****************************************************************************
myparser.y
ParserWizard generated YACC file.
****************************************************************************/
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#line 52 "myparser.c"
/* repeated because of possible precompiled header */
#include <yypars.h>
/* namespaces */
#if defined(__cplusplus) && defined(YYSTDCPPLIB)
using namespace std;
#endif
#if defined(__cplusplus) && defined(YYNAMESPACE)
using namespace yl;
#endif
#define YYFASTPARSER
#include ".\myparser.h"
#line 37 ".\\myparser.y"
int num;
#line 72 "myparser.c"
#ifndef YYSTYPE
#define YYSTYPE int
#endif
#ifndef YYSTACK_SIZE
#define YYSTACK_SIZE 100
#endif
#ifndef YYSTACK_MAX
#define YYSTACK_MAX 0
#endif
/* (state) stack */
#if (YYSTACK_SIZE) != 0
static yystack_t YYNEAR yystack[(YYSTACK_SIZE)];
yystack_t YYFAR *YYNEAR YYDCDECL yysstackptr = yystack;
yystack_t YYFAR *YYNEAR YYDCDECL yystackptr = yystack;
#else
yystack_t YYFAR *YYNEAR YYDCDECL yysstackptr = NULL;
yystack_t YYFAR *YYNEAR YYDCDECL yystackptr = NULL;
#endif
/* attribute stack */
#if (YYSTACK_SIZE) != 0
static YYSTYPE YYNEAR yyattributestack[(YYSTACK_SIZE)];
#ifdef YYPROTOTYPE
void YYFAR *YYNEAR YYDCDECL yysattributestackptr = yyattributestack;
void YYFAR *YYNEAR YYDCDECL yyattributestackptr = yyattributestack;
#else
char YYFAR *YYNEAR YYDCDECL yysattributestackptr = (char YYFAR *) yyattributestack;
char YYFAR *YYNEAR YYDCDECL yyattributestackptr = (char YYFAR *) yyattributestack;
#endif
#else
#ifdef YYPROTOTYPE
void YYFAR *YYNEAR YYDCDECL yysattributestackptr = NULL;
void YYFAR *YYNEAR YYDCDECL yyattributestackptr = NULL;
#else
char YYFAR *YYNEAR YYDCDECL yysattributestackptr = NULL;
char YYFAR *YYNEAR YYDCDECL yyattributestackptr = NULL;
#endif
#endif
int YYNEAR YYDCDECL yysstack_size = (YYSTACK_SIZE);
int YYNEAR YYDCDECL yystack_size = (YYSTACK_SIZE);
int YYNEAR YYDCDECL yystack_max = (YYSTACK_MAX);
/* attributes */
YYSTYPE YYNEAR yyval;
YYSTYPE YYNEAR yylval;
#ifdef YYPROTOTYPE
void YYFAR *YYNEAR YYDCDECL yyvalptr = &yyval;
void YYFAR *YYNEAR YYDCDECL yylvalptr = &yylval;
#else
char YYFAR *YYNEAR YYDCDECL yyvalptr = (char *) &yyval;
char YYFAR *YYNEAR YYDCDECL yylvalptr = (char *) &yylval;
#endif
size_t YYNEAR YYDCDECL yyattribute_size = sizeof(YYSTYPE);
/* yyattribute */
#ifdef YYDEBUG
#ifdef YYPROTOTYPE
static YYSTYPE YYFAR *yyattribute1(int index)
#else
static YYSTYPE YYFAR *yyattribute1(index)
int index;
#endif
{
YYSTYPE YYFAR *p = &((YYSTYPE YYFAR *) yyattributestackptr)[yytop + index];
return p;
}
#define yyattribute(index) (*yyattribute1(index))
#else
#define yyattribute(index) (((YYSTYPE YYFAR *) yyattributestackptr)[yytop + (index)])
#endif
#ifdef YYDEBUG
#ifdef YYPROTOTYPE
static void yyinitdebug(YYSTYPE YYFAR **p, int count)
#else
static void yyinitdebug(p, count)
YYSTYPE YYFAR **p;
int count;
#endif
{
int i;
yyassert(p != NULL);
yyassert(count >= 1);
for (i = 0; i < count; i++) {
p[i] = &((YYSTYPE YYFAR *) yyattributestackptr)[yytop + i - (count - 1)];
}
}
#endif
#ifdef YYPROTOTYPE
void YYCDECL yyparseraction(int action)
#else
void YYCDECL yyparseraction(action)
int action;
#endif
{
switch (action) {
case 0:
{
#ifdef YYDEBUG
YYSTYPE YYFAR *yya[4];
yyinitdebug(yya, 4);
#endif
{
#line 48 ".\\myparser.y"
printf("%s\n", yyattribute(2 - 3).s);
#line 183 "myparser.c"
}
}
break;
case 1:
{
#ifdef YYDEBUG
YYSTYPE YYFAR *yya[4];
yyinitdebug(yya, 4);
#endif
{
#line 53 ".\\myparser.y"
sprintf(yyval.s, "%s %s +", yyattribute(1 - 3).s, yyattribute(3 - 3).s);
#line 196 "myparser.c"
}
}
break;
case 2:
{
#ifdef YYDEBUG
YYSTYPE YYFAR *yya[4];
yyinitdebug(yya, 4);
#endif
{
#line 54 ".\\myparser.y"
sprintf(yyval.s, "%s %s -", yyattribute(1 - 3).s, yyattribute(3 - 3).s);
#line 209 "myparser.c"
}
}
break;
case 3:
{
#ifdef YYDEBUG
YYSTYPE YYFAR *yya[4];
yyinitdebug(yya, 4);
#endif
{
#line 55 ".\\myparser.y"
sprintf(yyval.s, "%s %s *", yyattribute(1 - 3).s, yyattribute(3 - 3).s);
#line 222 "myparser.c"
}
}
break;
case 4:
{
#ifdef YYDEBUG
YYSTYPE YYFAR *yya[4];
yyinitdebug(yya, 4);
#endif
{
#line 56 ".\\myparser.y"
sprintf(yyval.s, "%s %s /", yyattribute(1 - 3).s, yyattribute(3 - 3).s);
#line 235 "myparser.c"
}
}
break;
case 5:
{
#ifdef YYDEBUG
YYSTYPE YYFAR *yya[4];
yyinitdebug(yya, 4);
#endif
{
#line 57 ".\\myparser.y"
sprintf(yyval.s, "%s", yyattribute(2 - 3).s);
#line 248 "myparser.c"
}
}
break;
case 6:
{
#ifdef YYDEBUG
YYSTYPE YYFAR *yya[3];
yyinitdebug(yya, 3);
#endif
{
#line 58 ".\\myparser.y"
sprintf(yyval.s, "%s -", yyattribute(2 - 2).s);
#line 261 "myparser.c"
}
}
break;
case 7:
{
#ifdef YYDEBUG
YYSTYPE YYFAR *yya[2];
yyinitdebug(yya, 2);
#endif
{
#line 59 ".\\myparser.y"
itoa(num,yyval.s,10);
#line 274 "myparser.c"
}
}
break;
default:
yyassert(0);
break;
}
}
#ifdef YYDEBUG
YYCONST yysymbol_t YYNEARFAR YYBASED_CODE YYDCDECL yysymbol[] = {
{ "$end", 0 },
{ "\'\\n\'", 10 },
{ "error", 256 },
{ "NUMBER", 257 },
{ "ADD", 258 },
{ "SUB", 259 },
{ "MUL", 260 },
{ "DIV", 261 },
{ "LE", 262 },
{ "RE", 263 },
{ "UMINUS", 264 },
{ NULL, 0 }
};
YYCONST char *YYCONST YYNEARFAR YYBASED_CODE YYDCDECL yyrule[] = {
"$accept: lines",
"lines: lines expr \'\\n\'",
"lines: lines \'\\n\'",
"lines:",
"expr: expr ADD expr",
"expr: expr SUB expr",
"expr: expr MUL expr",
"expr: expr DIV expr",
"expr: LE expr RE",
"expr: SUB expr",
"expr: NUMBER"
};
#endif
YYCONST yyreduction_t YYNEARFAR YYBASED_CODE YYDCDECL yyreduction[] = {
{ 0, 1, -1 },
{ 1, 3, 0 },
{ 1, 2, -1 },
{ 1, 0, -1 },
{ 2, 3, 1 },
{ 2, 3, 2 },
{ 2, 3, 3 },
{ 2, 3, 4 },
{ 2, 3, 5 },
{ 2, 2, 6 },
{ 2, 1, 7 }
};
int YYNEAR YYDCDECL yytokenaction_size = 254;
YYCONST yytokenaction_t YYNEARFAR YYBASED_CODE YYDCDECL yytokenaction[] = {
{ 6, YYAT_SHIFT, 9 },
{ 8, YYAT_SHIFT, 10 },
{ 8, YYAT_SHIFT, 11 },
{ 8, YYAT_SHIFT, 12 },
{ 8, YYAT_SHIFT, 13 },
{ 1, YYAT_ACCEPT, 0 },
{ 8, YYAT_SHIFT, 14 },
{ 13, YYAT_SHIFT, 3 },
{ -1, YYAT_ERROR, 0 },
{ 13, YYAT_SHIFT, 4 },
{ 16, YYAT_SHIFT, 12 },
{ 16, YYAT_SHIFT, 13 },
{ 13, YYAT_SHIFT, 5 },
{ 15, YYAT_SHIFT, 12 },
{ 15, YYAT_SHIFT, 13 },
{ 1, YYAT_SHIFT, 2 },
{ -1, YYAT_ERROR, 0 },
{ -1, YYAT_ERROR, 0 },
{ -1, YYAT_ERROR, 0 },
{ -1, YYAT_ERROR, 0 },
{ -1, Y
预编译作业3(final).rar_drawnng1_successvrr_yacc后缀_yacc实现简单计算器后缀表达式打印_
版权申诉
25 浏览量
2022-09-20
11:07:51
上传
评论
收藏 983KB RAR 举报
Kinonoyomeo
- 粉丝: 77
- 资源: 1万+
评论0