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

📄 2.tab.c

📁 打开2.tab.c编译运行
💻 C
📖 第 1 页 / 共 3 页
字号:
/* A Bison parser, made from 2.y
   by GNU bison 1.35.  */

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

# define	IF	257
# define	THEN	258
# define	WHILE	259
# define	DO	260
# define	READ	261
# define	WRITE	262
# define	CALL	263
# define	BEGIN	264
# define	END	265
# define	CONST	266
# define	VAR	267
# define	PROCEDURE	268
# define	ODD	269
# define	ADD	270
# define	MINUS	271
# define	MULTIPLY	272
# define	DIVIDE	273
# define	EQUAL	274
# define	UNEQUAL	275
# define	LESS	276
# define	LESSEQUAL	277
# define	MORE	278
# define	MOREEQUAL	279
# define	EVALUATE	280
# define	LPARENTHESES	281
# define	RPARENTHESES	282
# define	COMMA	283
# define	SEMICOLON	284
# define	DOT	285
# define	NOSIGNINTEGER	286
# define	IDENT	287

#line 1 "2.y"

#include<stdio.h>
#include<string.h>
#include"lex.yy.c"
#ifndef YYSTYPE
# define YYSTYPE int
# define YYSTYPE_IS_TRIVIAL 1
#endif
#ifndef YYDEBUG
# define YYDEBUG 0
#endif



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

/* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
#define YYTRANSLATE(x) ((unsigned)(x) <= 287 ? yytranslate[x] : 60)

/* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */
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,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     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,    29,    30,    31,    32,    33
};

#if YYDEBUG
static const short yyprhs[] =
{
       0,     0,     3,     8,    12,    16,    20,    23,    26,    29,
      31,    35,    37,    41,    45,    49,    51,    55,    61,    65,
      69,    71,    73,    75,    77,    79,    81,    83,    84,    88,
      92,    94,    98,   102,   105,   110,   113,   116,   118,   120,
     124,   128,   130,   132,   136,   140,   142,   144,   148,   150,
     152,   154,   156,   158,   160,   165,   168,   173,   178,   180
};
static const short yyrhs[] =
{
      35,    31,     0,    36,    39,    41,    43,     0,    39,    41,
      43,     0,    36,    41,    43,     0,    36,    39,    43,     0,
      36,    43,     0,    39,    43,     0,    41,    43,     0,    43,
       0,    12,    37,    30,     0,    38,     0,    37,    29,    38,
       0,    33,    26,    32,     0,    13,    40,    30,     0,    33,
       0,    40,    29,    33,     0,    42,    35,    30,    41,    30,
       0,    42,    35,    30,     0,    14,    33,    30,     0,    44,
       0,    45,     0,    48,     0,    55,     0,    56,     0,    57,
       0,    58,     0,     0,    33,    26,    49,     0,    10,    46,
      11,     0,    43,     0,    46,    30,    43,     0,    49,    54,
      49,     0,    15,    49,     0,     3,    47,     4,    43,     0,
      16,    50,     0,    17,    50,     0,    50,     0,    51,     0,
      50,    16,    51,     0,    50,    17,    51,     0,    52,     0,
      53,     0,    52,    18,    53,     0,    52,    19,    53,     0,
      33,     0,    32,     0,    27,    49,    28,     0,    20,     0,
      21,     0,    22,     0,    23,     0,    24,     0,    25,     0,
       5,    47,     6,    43,     0,     9,    33,     0,     7,    27,
      40,    28,     0,     8,    27,    59,    28,     0,    49,     0,
      59,    29,    49,     0
};

#endif

#if YYDEBUG
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const short yyrline[] =
{
       0,    14,    18,    20,    22,    24,    26,    28,    30,    32,
      37,    42,    44,    49,    54,    59,    61,    66,    68,    72,
      77,    79,    81,    83,    85,    87,    89,    91,    96,   101,
     106,   108,   113,   115,   120,   125,   127,   129,   134,   136,
     138,   143,   148,   150,   152,   157,   159,   161,   166,   168,
     170,   172,   174,   176,   181,   186,   191,   196,   201,   203
};
#endif


#if (YYDEBUG) || defined YYERROR_VERBOSE

/* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */
static const char *const yytname[] =
{
  "$", "error", "$undefined.", "IF", "THEN", "WHILE", "DO", "READ", "WRITE", 
  "CALL", "BEGIN", "END", "CONST", "VAR", "PROCEDURE", "ODD", "ADD", 
  "MINUS", "MULTIPLY", "DIVIDE", "EQUAL", "UNEQUAL", "LESS", "LESSEQUAL", 
  "MORE", "MOREEQUAL", "EVALUATE", "LPARENTHESES", "RPARENTHESES", 
  "COMMA", "SEMICOLON", "DOT", "NOSIGNINTEGER", "IDENT", "Program", 
  "PartialProgram", "ConstantDeclaration", "ConstList", "ConstDefination", 
  "VariableDeclaration", "IdentList", "ProcedureDeclaration", 
  "ProcedureHead", "Statement", "EvaluateStatement", "ComplexStatement", 
  "StatementList", "Condition", "ConditionStatement", "Expression", 
  "TermList", "Term", "GeneList", "Gene", "RelationOperator", 
  "WhileStatement", "ProcedureCallStatement", "ReadStatement", 
  "WriteStatement", "ExpressionList", 0
};
#endif

/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const short yyr1[] =
{
       0,    34,    35,    35,    35,    35,    35,    35,    35,    35,
      36,    37,    37,    38,    39,    40,    40,    41,    41,    42,
      43,    43,    43,    43,    43,    43,    43,    43,    44,    45,
      46,    46,    47,    47,    48,    49,    49,    49,    50,    50,
      50,    51,    52,    52,    52,    53,    53,    53,    54,    54,
      54,    54,    54,    54,    55,    56,    57,    58,    59,    59
};

/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
static const short yyr2[] =
{
       0,     2,     4,     3,     3,     3,     2,     2,     2,     1,
       3,     1,     3,     3,     3,     1,     3,     5,     3,     3,
       1,     1,     1,     1,     1,     1,     1,     0,     3,     3,
       1,     3,     3,     2,     4,     2,     2,     1,     1,     3,
       3,     1,     1,     3,     3,     1,     1,     3,     1,     1,
       1,     1,     1,     1,     4,     2,     4,     4,     1,     3
};

/* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
   doesn't specify something else to do.  Zero means the default is an
   error. */
static const short yydefact[] =
{
      27,     0,     0,     0,     0,     0,    27,     0,     0,     0,
       0,     0,    27,    27,    27,    27,     9,    20,    21,    22,
      23,    24,    25,    26,     0,     0,     0,     0,    46,    45,
       0,     0,    37,    38,    41,    42,     0,     0,     0,    55,
      30,     0,     0,     0,    11,    15,     0,     0,     0,     1,
      27,    27,     6,    27,     7,     8,     0,    33,    35,    36,
       0,    27,    48,    49,    50,    51,    52,    53,     0,     0,
       0,     0,     0,    27,     0,    58,     0,    29,    27,     0,
       0,    10,     0,    14,    19,    28,    27,     5,     4,     3,
      18,    47,    34,    32,    39,    40,    43,    44,    54,    56,
      57,     0,    31,    13,    12,    16,     2,     0,    59,    17,
       0,     0,     0
};

static const short yydefgoto[] =
{
     110,    11,    12,    43,    44,    13,    46,    14,    15,    16,
      17,    18,    41,    30,    19,    31,    32,    33,    34,    35,
      68,    20,    21,    22,    23,    76
};

static const short yypact[] =
{
       8,    33,    33,   -22,   -17,   -19,    66,   -14,    -8,     3,
      14,    25,    21,    54,    66,     8,-32768,-32768,-32768,-32768,
  -32768,-32768,-32768,-32768,    61,     5,     5,    61,-32768,-32768,
      81,    80,   -13,-32768,    24,-32768,    64,    -8,    61,-32768,
  -32768,    16,    32,    22,-32768,-32768,    52,    59,    61,-32768,
      54,    66,-32768,    66,-32768,-32768,    78,-32768,   -13,   -13,
      82,    66,-32768,-32768,-32768,-32768,-32768,-32768,    61,     5,
       5,     5,     5,    66,    55,-32768,    62,-32768,    66,    60,
     -14,-32768,    76,-32768,-32768,-32768,    66,-32768,-32768,-32768,
      97,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
  -32768,    61,-32768,-32768,-32768,-32768,-32768,    83,-32768,-32768,
     112,   114,-32768
};

static const short yypgoto[] =
{
  -32768,   100,-32768,-32768,    36,   105,    84,   -11,-32768,    -6,
  -32768,-32768,-32768,   116,-32768,   -15,    70,    28,-32768,    35,
  -32768,-32768,-32768,-32768,-32768,-32768
};


#define	YYLAST		121


static const short yytable[] =
{
      40,    51,    53,    69,    70,    37,    52,    54,    55,    57,
      38,     1,    60,     2,    39,     3,     4,     5,     6,    42,
       7,     8,     9,    75,     1,    45,     2,    77,     3,     4,
       5,     6,    27,    85,     8,     9,    47,    28,    29,    86,
      48,    10,    71,    72,    87,    88,    78,    89,    24,    25,
      26,    80,    81,    93,    10,    92,    49,     1,    79,     2,
      27,     3,     4,     5,     6,    28,    29,    98,     9,     1,
      73,     2,   102,     3,     4,     5,     6,    25,    26,   107,
     106,    82,    83,    99,    82,    61,   108,    10,    27,    84,
     100,   101,   103,    28,    29,    58,    59,    94,    95,    10,
      62,    63,    64,    65,    66,    67,    96,    97,    90,   105,
      91,     9,   111,   109,   112,    56,   104,    50,    36,     0,
       0,    74
};

static const short yycheck[] =
{
       6,    12,    13,    16,    17,    27,    12,    13,    14,    24,
      27,     3,    27,     5,    33,     7,     8,     9,    10,    33,
      12,    13,    14,    38,     3,    33,     5,    11,     7,     8,
       9,    10,    27,    48,    13,    14,    33,    32,    33,    50,
      26,    33,    18,    19,    50,    51,    30,    53,    15,    16,
      17,    29,    30,    68,    33,    61,    31,     3,    26,     5,
      27,     7,     8,     9,    10,    32,    33,    73,    14,     3,
       6,     5,    78,     7,     8,     9,    10,    16,    17,    90,
      86,    29,    30,    28,    29,     4,   101,    33,    27,    30,
      28,    29,    32,    32,    33,    25,    26,    69,    70,    33,
      20,    21,    22,    23,    24,    25,    71,    72,    30,    33,
      28,    14,     0,    30,     0,    15,    80,    12,     2,    -1,
      -1,    37
};
/* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
#line 3 "bison.simple"

/* Skeleton output parser for 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.  */

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

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

#if ! defined (yyoverflow) || defined (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) || defined (YYERROR_VERBOSE) */


#if (! defined (yyoverflow) \
     && (! defined (__cplusplus) \
	 || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))

/* A type that is properly aligned for any stack member.  */
union yyalloc
{
  short yyss;
  YYSTYPE yyvs;
# if YYLSP_NEEDED
  YYLTYPE yyls;
# endif
};

/* The size of the maximum gap between one aligned stack and the next.  */
# define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)

/* The size of an array large to enough to hold all stacks, each with
   N elements.  */
# if YYLSP_NEEDED
#  define YYSTACK_BYTES(N) \
     ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE))	\
      + 2 * YYSTACK_GAP_MAX)
# else
#  define YYSTACK_BYTES(N) \
     ((N) * (sizeof (short) + sizeof (YYSTYPE))				\
      + YYSTACK_GAP_MAX)
# endif

/* 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_MAX;	\
	yyptr += yynewbytes / sizeof (*yyptr);				\
      }									\
    while (0)

#endif


#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
# define YYSIZE_T __SIZE_TYPE__
#endif
#if ! defined (YYSIZE_T) && defined (size_t)
# define YYSIZE_T size_t
#endif
#if ! defined (YYSIZE_T)
# if defined (__STDC__) || defined (__cplusplus)
#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
#  define YYSIZE_T size_t
# endif
#endif
#if ! defined (YYSIZE_T)
# define YYSIZE_T unsigned int
#endif

#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


/* YYLLOC_DEFAULT -- Compute the default location (before the actions
   are run).

   When YYLLOC_DEFAULT is run, CURRENT is set the location of the
   first token.  By default, to implement support for ranges, extend
   its range to the last symbol.  */

#ifndef YYLLOC_DEFAULT
# define YYLLOC_DEFAULT(Current, Rhs, N)       	\
   Current.last_line   = Rhs[N].last_line;	\
   Current.last_column = Rhs[N].last_column;
#endif


/* YYLEX -- calling `yylex' with the right arguments.  */

#if YYPURE
# if YYLSP_NEEDED
#  ifdef YYLEX_PARAM
#   define YYLEX		yylex (&yylval, &yylloc, YYLEX_PARAM)
#  else
#   define YYLEX		yylex (&yylval, &yylloc)
#  endif
# else /* !YYLSP_NEEDED */
#  ifdef YYLEX_PARAM
#   define YYLEX		yylex (&yylval, YYLEX_PARAM)
#  else
#   define YYLEX		yylex (&yylval)
#  endif
# endif /* !YYLSP_NEEDED */
#else /* !YYPURE */
# define YYLEX			yylex ()
#endif /* !YYPURE */

⌨️ 快捷键说明

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