⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 yacc.tab.c

📁 C语言表达式语法分析器
💻 C
📖 第 1 页 / 共 4 页
字号:

/*  A Bison parser, made from yacc
    by GNU Bison version 1.28  */

#define YYBISON 1  /* Identify Bison output.  */

#define	EXIT_YY	257
#define	CONSTANT	258
#define	IDENTIFIER	259
#define	FUNCTION	260
#define	SIZEOF	261
#define	PTR_OP	262
#define	INC_OP	263
#define	DEC_OP	264
#define	LEFT_OP	265
#define	RIGHT_OP	266
#define	LE_OP	267
#define	GE_OP	268
#define	EQ_OP	269
#define	NE_OP	270
#define	AND_OP	271
#define	OR_OP	272
#define	MUL_ASSIGN	273
#define	DIV_ASSIGN	274
#define	MOD_ASSIGN	275
#define	ADD_ASSIGN	276
#define	SUB_ASSIGN	277
#define	LEFT_ASSIGN	278
#define	RIGHT_ASSIGN	279
#define	AND_ASSIGN	280
#define	XOR_ASSIGN	281
#define	OR_ASSIGN	282

#line 1 "yacc"

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "head.h"
extern 	int yylex();
void 		yyerror(char *);
double 	unary_in(double ,char *);
double 	assignment_in(double, char *, double );
extern symrec 	* sym_table;
int ii=0;
int i;
extern FILE * fout;


#line 17 "yacc"
typedef union
{
int				ext;
double 		val;
listc * 	vall;
char 	* 	valc;
symrec*   tptr;
} YYSTYPE;
#include <stdio.h>

#ifndef __cplusplus
#ifndef __STDC__
#define const
#endif
#endif



#define	YYFINAL		112
#define	YYFLAG		-32768
#define	YYNTBASE	50

#define YYTRANSLATE(x) ((unsigned)(x) <= 282 ? yytranslate[x] : 72)

static const char yytranslate[] = {     0,
     2,     2,     2,     2,     2,     2,     2,     2,     2,    29,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,    38,     2,     2,     2,    41,    44,     2,    30,
    31,    39,    35,    34,    36,     2,    40,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,    48,     2,    42,
    49,    43,    47,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    32,     2,    33,    45,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,    46,     2,    37,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     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,    16,
    17,    18,    19,    20,    21,    22,    23,    24,    25,    26,
    27,    28
};

#if YYDEBUG != 0
static const short yyprhs[] = {     0,
     0,     1,     4,     7,     9,    12,    15,    17,    19,    23,
    25,    30,    34,    39,    42,    45,    47,    51,    53,    56,
    59,    62,    65,    67,    69,    71,    73,    75,    77,    81,
    85,    89,    91,    95,    99,   101,   105,   109,   111,   115,
   119,   123,   127,   129,   133,   137,   139,   143,   145,   149,
   151,   155,   157,   161,   163,   167,   169,   175,   177,   181,
   183,   185,   187,   189,   191,   193,   195,   197,   199,   201,
   203,   205
};

static const short yyrhs[] = {    -1,
    50,    51,     0,    50,     3,     0,    29,     0,    71,    29,
     0,     1,    29,     0,     5,     0,     4,     0,    30,    71,
    31,     0,    52,     0,    53,    32,    71,    33,     0,     6,
    30,    31,     0,     6,    30,    54,    31,     0,    53,     9,
     0,    53,    10,     0,    69,     0,    54,    34,    69,     0,
    53,     0,     9,    55,     0,    10,    55,     0,    56,    57,
     0,     7,    55,     0,    35,     0,    36,     0,    37,     0,
    38,     0,    55,     0,    57,     0,    58,    39,    57,     0,
    58,    40,    57,     0,    58,    41,    57,     0,    58,     0,
    59,    35,    58,     0,    59,    36,    58,     0,    59,     0,
    60,    11,    59,     0,    60,    12,    59,     0,    60,     0,
    61,    42,    60,     0,    61,    43,    60,     0,    61,    13,
    60,     0,    61,    14,    60,     0,    61,     0,    62,    15,
    61,     0,    62,    16,    61,     0,    62,     0,    63,    44,
    62,     0,    63,     0,    64,    45,    63,     0,    64,     0,
    65,    46,    64,     0,    65,     0,    66,    17,    65,     0,
    66,     0,    67,    18,    66,     0,    67,     0,    67,    47,
    71,    48,    68,     0,    68,     0,    55,    70,    69,     0,
    49,     0,    19,     0,    20,     0,    21,     0,    22,     0,
    23,     0,    24,     0,    25,     0,    26,     0,    27,     0,
    28,     0,    69,     0,    71,    34,    69,     0
};

#endif

#if YYDEBUG != 0
static const short yyrline[] = { 0,
    43,    44,    45,    48,    49,    53,    56,    57,    58,    62,
    63,    68,    73,    77,    78,    81,    82,    87,    88,    89,
    90,    91,    95,    96,    97,    98,   102,   106,   107,   108,
   109,   113,   114,   115,   119,   120,   121,   125,   126,   127,
   128,   129,   133,   134,   135,   139,   140,   144,   145,   149,
   150,   154,   155,   159,   160,   164,   165,   169,   170,   174,
   175,   176,   177,   178,   179,   180,   181,   182,   183,   184,
   188,   189
};
#endif


#if YYDEBUG != 0 || defined (YYERROR_VERBOSE)

static const char * const yytname[] = {   "$","error","$undefined.","EXIT_YY",
"CONSTANT","IDENTIFIER","FUNCTION","SIZEOF","PTR_OP","INC_OP","DEC_OP","LEFT_OP",
"RIGHT_OP","LE_OP","GE_OP","EQ_OP","NE_OP","AND_OP","OR_OP","MUL_ASSIGN","DIV_ASSIGN",
"MOD_ASSIGN","ADD_ASSIGN","SUB_ASSIGN","LEFT_ASSIGN","RIGHT_ASSIGN","AND_ASSIGN",
"XOR_ASSIGN","OR_ASSIGN","'\\n'","'('","')'","'['","']'","','","'+'","'-'","'~'",
"'!'","'*'","'/'","'%'","'<'","'>'","'&'","'^'","'|'","'?'","':'","'='","input",
"line","primary_expression","postfix_expression","argument_expression_list",
"unary_expression","unary_operator","cast_expression","multiplicative_expression",
"additive_expression","shift_expression","relational_expression","equality_expression",
"and_expression","exclusive_or_expression","inclusive_or_expression","logical_and_expression",
"logical_or_expression","conditional_expression","assignment_expression","assignment_operator",
"expression", NULL
};
#endif

static const short yyr1[] = {     0,
    50,    50,    50,    51,    51,    51,    52,    52,    52,    53,
    53,    53,    53,    53,    53,    54,    54,    55,    55,    55,
    55,    55,    56,    56,    56,    56,    57,    58,    58,    58,
    58,    59,    59,    59,    60,    60,    60,    61,    61,    61,
    61,    61,    62,    62,    62,    63,    63,    64,    64,    65,
    65,    66,    66,    67,    67,    68,    68,    69,    69,    70,
    70,    70,    70,    70,    70,    70,    70,    70,    70,    70,
    71,    71
};

static const short yyr2[] = {     0,
     0,     2,     2,     1,     2,     2,     1,     1,     3,     1,
     4,     3,     4,     2,     2,     1,     3,     1,     2,     2,
     2,     2,     1,     1,     1,     1,     1,     1,     3,     3,
     3,     1,     3,     3,     1,     3,     3,     1,     3,     3,
     3,     3,     1,     3,     3,     1,     3,     1,     3,     1,
     3,     1,     3,     1,     3,     1,     5,     1,     3,     1,
     1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
     1,     3
};

static const short yydefact[] = {     1,
     0,     0,     3,     8,     7,     0,     0,     0,     0,     4,
     0,    23,    24,    25,    26,     2,    10,    18,    27,     0,
    28,    32,    35,    38,    43,    46,    48,    50,    52,    54,
    56,    58,    71,     0,     6,     0,    22,    19,    20,     0,
    14,    15,     0,    61,    62,    63,    64,    65,    66,    67,
    68,    69,    70,    60,     0,    27,    21,     0,     0,     0,
     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     0,     0,     0,     0,     0,     0,     5,     0,    12,     0,
    16,     9,     0,    59,    29,    30,    31,    33,    34,    36,
    37,    41,    42,    39,    40,    44,    45,    47,    49,    51,
    53,    55,     0,    72,    13,     0,    11,     0,    17,    57,
     0,     0
};

static const short yydefgoto[] = {     1,
    16,    17,    18,    80,    56,    20,    21,    22,    23,    24,
    25,    26,    27,    28,    29,    30,    31,    32,    33,    55,
    34
};

static const short yypact[] = {-32768,
    21,   -13,-32768,-32768,-32768,     9,    74,    74,    74,-32768,
    74,-32768,-32768,-32768,-32768,-32768,-32768,     4,    94,    74,
-32768,     5,    17,    57,   -10,    58,   -21,    -8,    18,    12,
    -7,-32768,-32768,   -17,-32768,    56,-32768,-32768,-32768,   -16,
-32768,-32768,    74,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,    74,-32768,-32768,    74,    74,    74,
    74,    74,    74,    74,    74,    74,    74,    74,    74,    74,
    74,    74,    74,    74,    74,    74,-32768,    74,-32768,     7,
-32768,-32768,    55,-32768,-32768,-32768,-32768,     5,     5,    17,
    17,    57,    57,    57,    57,   -10,   -10,    58,   -21,    -8,
    18,    12,   -29,-32768,-32768,    74,-32768,    74,-32768,-32768,
    70,-32768
};

static const short yypgoto[] = {-32768,
-32768,-32768,-32768,-32768,    -1,-32768,   -11,    38,    39,    30,
    37,     1,    10,   -18,     2,    15,-32768,   -23,   -35,-32768,
    -9
};


#define	YYLAST		143


static const short yytable[] = {    19,
    81,    40,    65,    66,    78,    37,    38,    39,    57,    19,
    75,    77,    41,    42,    82,    35,    78,    78,   108,    84,
   111,     2,    71,     3,     4,     5,     6,     7,    74,     8,
     9,    67,    68,    83,    19,    43,    72,   105,    36,    76,
   106,    19,   104,    58,    59,    60,    85,    86,    87,    10,
    11,    61,    62,    19,   100,    12,    13,    14,    15,     4,
     5,     6,     7,    73,     8,     9,   103,    63,    64,   112,
   109,    98,    69,    70,    19,   101,    19,     4,     5,     6,
     7,    99,     8,     9,   110,    11,    79,   107,    78,   102,
    12,    13,    14,    15,    92,    93,    94,    95,    88,    89,
     0,    90,    91,    11,    19,    96,    97,     0,    12,    13,
    14,    15,    44,    45,    46,    47,    48,    49,    50,    51,
    52,    53,     0,     0,     0,     0,     0,     0,     0,     0,
     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     0,     0,    54
};

static const short yycheck[] = {     1,
    36,    11,    13,    14,    34,     7,     8,     9,    20,    11,
    18,    29,     9,    10,    31,    29,    34,    34,    48,    55,
     0,     1,    44,     3,     4,     5,     6,     7,    17,     9,
    10,    42,    43,    43,    36,    32,    45,    31,    30,    47,
    34,    43,    78,    39,    40,    41,    58,    59,    60,    29,
    30,    35,    36,    55,    73,    35,    36,    37,    38,     4,
     5,     6,     7,    46,     9,    10,    76,    11,    12,     0,
   106,    71,    15,    16,    76,    74,    78,     4,     5,     6,
     7,    72,     9,    10,   108,    30,    31,    33,    34,    75,
    35,    36,    37,    38,    65,    66,    67,    68,    61,    62,
    -1,    63,    64,    30,   106,    69,    70,    -1,    35,    36,
    37,    38,    19,    20,    21,    22,    23,    24,    25,    26,
    27,    28,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
    -1,    -1,    49
};
/* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
#line 3 "bison.simple"

/* Skeleton output parser for bison,
   Copyright (C) 1984, 1989, 1990 Bob Corbett and Richard Stallman

   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 1, 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.  */


#ifndef alloca
#ifdef __GNUC__
#define alloca __builtin_alloca
#else /* not GNU C.  */
#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc)
#include <alloca.h>
#else /* not sparc */
#if (defined (MSDOS) || defined(WIN32)) && !defined (__TURBOC__)
#include <malloc.h>
#else /* not MSDOS, or __TURBOC__ */
#if defined(_AIX)
#include <malloc.h>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -