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

📄 test.tab.c

📁 对pl0语言程序的语法分析源程序
💻 C
📖 第 1 页 / 共 4 页
字号:
/* A Bison parser, made from test.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	BEG	264
# define	END	265
# define	CONST	266
# define	VAR	267
# define	PROCEDURE	268
# define	ODD	269
# define	CONCAT	270
# define	MINUS	271
# define	MULTI	272
# define	DIVIDE	273
# define	END_STMT	274
# define	OPEN_PAR	275
# define	CLOSE_PAR	276
# define	PAUSE	277
# define	DOT	278
# define	ASSIGN	279
# define	DASSIGN	280
# define	JING	281
# define	SM_EQ	282
# define	BI_EQ	283
# define	SMALL	284
# define	BIG	285
# define	ID	286
# define	NUM	287
# define	ERRORTOKEN	288

#line 1 "test.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		134
#define	YYFLAG		-32768
#define	YYNTBASE	35

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

/* 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,    34
};

#if YYDEBUG
static const short yyprhs[] =
{
       0,     0,     3,     8,    12,    15,    19,    23,    26,    29,
      31,    36,    40,    44,    47,    51,    56,    60,    63,    67,
      72,    76,    79,    83,    87,    89,    91,    93,    95,    97,
      99,   101,   102,   106,   111,   115,   118,   122,   126,   129,
     134,   138,   142,   145,   147,   150,   153,   157,   160,   163,
     165,   169,   172,   174,   176,   180,   182,   184,   186,   188,
     190,   192,   194,   196,   198,   200,   205,   208,   214,   219,
     225,   230,   234
};
static const short yyrhs[] =
{
      36,    24,     0,    37,    40,    42,    45,     0,    37,    40,
      45,     0,    37,    45,     0,    37,    42,    45,     0,    40,
      42,    45,     0,    40,    45,     0,    42,    45,     0,    45,
       0,    12,    39,    38,    20,     0,    12,    39,    20,     0,
      38,    23,    39,     0,    23,    39,     0,    32,    26,    33,
       0,    13,    32,    41,    20,     0,    13,    32,    20,     0,
      23,    32,     0,    41,    23,    32,     0,    44,    36,    43,
      20,     0,    44,    36,    20,     0,    20,    42,     0,    43,
      20,    42,     0,    14,    32,    20,     0,    46,     0,    47,
       0,    50,     0,    59,     0,    60,     0,    61,     0,    62,
       0,     0,    32,    26,    51,     0,    10,    45,    48,    11,
       0,    10,    45,    11,     0,    20,    45,     0,    48,    20,
      45,     0,    51,    58,    51,     0,    15,    51,     0,     3,
      49,     4,    45,     0,    16,    53,    52,     0,    17,    53,
      52,     0,    53,    52,     0,    53,     0,    16,    53,     0,
      17,    53,     0,    52,    56,    53,     0,    56,    53,     0,
      55,    54,     0,    55,     0,    54,    57,    55,     0,    57,
      55,     0,    32,     0,    33,     0,    21,    51,    22,     0,
      16,     0,    17,     0,    18,     0,    19,     0,    25,     0,
      27,     0,    30,     0,    31,     0,    28,     0,    29,     0,
       5,    49,     6,    45,     0,     9,    32,     0,     7,    21,
      32,    41,    22,     0,     7,    21,    32,    22,     0,     8,
      21,    51,    63,    22,     0,     8,    21,    51,    22,     0,
      63,    23,    51,     0,    23,    51,     0
};

#endif

#if YYDEBUG
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const short yyrline[] =
{
       0,    16,    20,    21,    22,    23,    24,    25,    26,    27,
      31,    32,    36,    37,    41,    45,    46,    50,    51,    55,
      56,    60,    61,    65,    69,    70,    71,    72,    73,    74,
      75,    76,    80,    84,    85,    89,    90,    94,    95,    99,
     103,   104,   105,   106,   107,   108,   112,   113,   117,   118,
     122,   123,   127,   128,   129,   133,   134,   138,   139,   143,
     144,   145,   146,   147,   148,   152,   156,   160,   161,   165,
     166,   170,   171
};
#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", "BEG", "END", "CONST", "VAR", "PROCEDURE", "ODD", "CONCAT", 
  "MINUS", "MULTI", "DIVIDE", "END_STMT", "OPEN_PAR", "CLOSE_PAR", 
  "PAUSE", "DOT", "ASSIGN", "DASSIGN", "JING", "SM_EQ", "BI_EQ", "SMALL", 
  "BIG", "ID", "NUM", "ERRORTOKEN", "program", "segment", "const_explain", 
  "const_defi_list", "const_defi", "vari_explain", "ID_list", 
  "proce_explain", "pro_explain_list", "proce_head", "statement", 
  "assign_statement", "compound_statement", "statement_list", "condition", 
  "if_statement", "expression", "con_term_list", "term", 
  "mul_op_elem_list", "elem", "con_op", "mul_op", "relation_op", 
  "while_statement", "pro_statement", "read_statement", "write_statement", 
  "expression_list", 0
};
#endif

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

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

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

static const short yydefgoto[] =
{
     132,    11,    12,    81,    40,    13,    84,    14,    92,    15,
      16,    17,    18,    77,    30,    19,    31,    66,    32,    70,
      33,    67,    71,    63,    20,    21,    22,    23,   107
};

static const short yypact[] =
{
      46,     5,     5,   -14,    -9,   -15,   107,     2,     4,    11,
      22,    33,    77,    89,   107,    46,-32768,-32768,-32768,-32768,
  -32768,-32768,-32768,-32768,   102,    -8,    -8,   102,-32768,-32768,
      24,    36,    -1,    70,    56,    37,   102,-32768,     7,    49,
       9,    50,    57,   102,-32768,    89,   107,-32768,   107,-32768,
  -32768,    61,-32768,    -1,    -1,    73,   107,-32768,-32768,-32768,
  -32768,-32768,-32768,   102,-32768,-32768,    -1,    -8,-32768,-32768,
      70,    -8,   107,   103,   105,-32768,   107,    20,    67,-32768,
       2,    51,-32768,    75,    81,-32768,-32768,   107,-32768,-32768,
  -32768,    88,    85,    -1,    -1,-32768,-32768,-32768,    -8,-32768,
      -8,-32768,-32768,-32768,   108,-32768,   102,   110,-32768,-32768,
     107,-32768,-32768,-32768,     2,-32768,-32768,    79,-32768,-32768,
      88,-32768,-32768,-32768,-32768,-32768,   102,-32768,-32768,-32768,
  -32768,-32768,   120,   122,-32768
};

static const short yypgoto[] =
{
  -32768,   109,-32768,-32768,   -75,   117,    65,   -12,-32768,-32768,
      -4,-32768,-32768,-32768,   138,-32768,   -13,    83,   -22,-32768,
     -65,   -47,    71,-32768,-32768,-32768,-32768,-32768,-32768
};


#define	YYLAST		141


static const short yytable[] =
{
      46,    48,    38,    53,    54,   112,   101,    35,    47,    49,
      50,    52,    36,    27,    55,    64,    65,    37,    75,    98,
      24,    25,    26,    74,    28,    29,    27,    76,    56,    79,
      86,   109,    80,    87,    39,   122,    41,    28,    29,   128,
     110,    88,    89,    42,    90,    99,    98,    98,    43,     1,
      97,     2,    96,     3,     4,     5,     6,    44,     7,     8,
       9,    57,    72,    58,    59,    60,    61,    62,   102,    73,
      82,   113,   108,    83,   114,    78,   121,    85,    10,   119,
       1,    91,     2,   118,     3,     4,     5,     6,    68,    69,
       8,     9,     1,   124,     2,    95,     3,     4,     5,     6,
     111,   116,     9,     9,   117,   120,   127,   115,   130,    10,
       1,   129,     2,   131,     3,     4,     5,     6,    25,    26,
     133,    10,   134,    27,    51,   103,    83,   105,   106,    45,
     123,   117,   125,   126,    28,    29,    93,    94,   104,    10,
      34,   100
};

static const short yycheck[] =
{
      12,    13,     6,    25,    26,    80,    71,    21,    12,    13,
      14,    24,    21,    21,    27,    16,    17,    32,    11,    66,
      15,    16,    17,    36,    32,    33,    21,    20,     4,    20,
      43,    11,    23,    45,    32,   100,    32,    32,    33,   114,
      20,    45,    46,    32,    48,    67,    93,    94,    26,     3,
      63,     5,    56,     7,     8,     9,    10,    24,    12,    13,
      14,    25,     6,    27,    28,    29,    30,    31,    72,    32,
      20,    20,    76,    23,    23,    26,    98,    20,    32,    91,
       3,    20,     5,    87,     7,     8,     9,    10,    18,    19,
      13,    14,     3,   106,     5,    22,     7,     8,     9,    10,
      33,    20,    14,    14,    23,    20,   110,    32,   120,    32,
       3,    32,     5,   126,     7,     8,     9,    10,    16,    17,
       0,    32,     0,    21,    15,    22,    23,    22,    23,    12,
      22,    23,    22,    23,    32,    33,    53,    54,    73,    32,
       2,    70
};
/* -*-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))				\

⌨️ 快捷键说明

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