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

📄 test.tab.c

📁 对pl0语言程序的语法分析源程序
💻 C
📖 第 1 页 / 共 4 页
字号:
	yyoverflow ("parser stack overflow",
		    &yyss1, yysize * sizeof (*yyssp),
		    &yyvs1, yysize * sizeof (*yyvsp),
		    &yyls1, yysize * sizeof (*yylsp),
		    &yystacksize);
	yyls = yyls1;
# else
	yyoverflow ("parser stack overflow",
		    &yyss1, yysize * sizeof (*yyssp),
		    &yyvs1, yysize * sizeof (*yyvsp),
		    &yystacksize);
# endif
	yyss = yyss1;
	yyvs = yyvs1;
      }
#else /* no yyoverflow */
# ifndef YYSTACK_RELOCATE
      goto yyoverflowlab;
# else
      /* Extend the stack our own way.  */
      if (yystacksize >= YYMAXDEPTH)
	goto yyoverflowlab;
      yystacksize *= 2;
      if (yystacksize > YYMAXDEPTH)
	yystacksize = YYMAXDEPTH;

      {
	short *yyss1 = yyss;
	union yyalloc *yyptr =
	  (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
	if (! yyptr)
	  goto yyoverflowlab;
	YYSTACK_RELOCATE (yyss);
	YYSTACK_RELOCATE (yyvs);
# if YYLSP_NEEDED
	YYSTACK_RELOCATE (yyls);
# endif
# undef YYSTACK_RELOCATE
	if (yyss1 != yyssa)
	  YYSTACK_FREE (yyss1);
      }
# endif
#endif /* no yyoverflow */

      yyssp = yyss + yysize - 1;
      yyvsp = yyvs + yysize - 1;
#if YYLSP_NEEDED
      yylsp = yyls + yysize - 1;
#endif

      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
		  (unsigned long int) yystacksize));

      if (yyssp >= yyss + yystacksize - 1)
	YYABORT;
    }

  YYDPRINTF ((stderr, "Entering state %d\n", yystate));

  goto yybackup;


/*-----------.
| yybackup.  |
`-----------*/
yybackup:

/* Do appropriate processing given the current state.  */
/* Read a lookahead token if we need one and don't already have one.  */
/* yyresume: */

  /* First try to decide what to do without reference to lookahead token.  */

  yyn = yypact[yystate];
  if (yyn == YYFLAG)
    goto yydefault;

  /* Not known => get a lookahead token if don't already have one.  */

  /* yychar is either YYEMPTY or YYEOF
     or a valid token in external form.  */

  if (yychar == YYEMPTY)
    {
      YYDPRINTF ((stderr, "Reading a token: "));
      yychar = YYLEX;
    }

  /* Convert token to internal form (in yychar1) for indexing tables with */

  if (yychar <= 0)		/* This means end of input. */
    {
      yychar1 = 0;
      yychar = YYEOF;		/* Don't call YYLEX any more */

      YYDPRINTF ((stderr, "Now at end of input.\n"));
    }
  else
    {
      yychar1 = YYTRANSLATE (yychar);

#if YYDEBUG
     /* We have to keep this `#if YYDEBUG', since we use variables
	which are defined only if `YYDEBUG' is set.  */
      if (yydebug)
	{
	  YYFPRINTF (stderr, "Next token is %d (%s",
		     yychar, yytname[yychar1]);
	  /* Give the individual parser a way to print the precise
	     meaning of a token, for further debugging info.  */
# ifdef YYPRINT
	  YYPRINT (stderr, yychar, yylval);
# endif
	  YYFPRINTF (stderr, ")\n");
	}
#endif
    }

  yyn += yychar1;
  if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
    goto yydefault;

  yyn = yytable[yyn];

  /* yyn is what to do for this token type in this state.
     Negative => reduce, -yyn is rule number.
     Positive => shift, yyn is new state.
       New state is final state => don't bother to shift,
       just return success.
     0, or most negative number => error.  */

  if (yyn < 0)
    {
      if (yyn == YYFLAG)
	goto yyerrlab;
      yyn = -yyn;
      goto yyreduce;
    }
  else if (yyn == 0)
    goto yyerrlab;

  if (yyn == YYFINAL)
    YYACCEPT;

  /* Shift the lookahead token.  */
  YYDPRINTF ((stderr, "Shifting token %d (%s), ",
	      yychar, yytname[yychar1]));

  /* Discard the token being shifted unless it is eof.  */
  if (yychar != YYEOF)
    yychar = YYEMPTY;

  *++yyvsp = yylval;
#if YYLSP_NEEDED
  *++yylsp = yylloc;
#endif

  /* Count tokens shifted since error; after three, turn off error
     status.  */
  if (yyerrstatus)
    yyerrstatus--;

  yystate = yyn;
  goto yynewstate;


/*-----------------------------------------------------------.
| yydefault -- do the default action for the current state.  |
`-----------------------------------------------------------*/
yydefault:
  yyn = yydefact[yystate];
  if (yyn == 0)
    goto yyerrlab;
  goto yyreduce;


/*-----------------------------.
| yyreduce -- Do a reduction.  |
`-----------------------------*/
yyreduce:
  /* yyn is the number of a rule to reduce with.  */
  yylen = yyr2[yyn];

  /* If YYLEN is nonzero, implement the default value of the action:
     `$$ = $1'.

     Otherwise, the following line sets YYVAL to the semantic value of
     the lookahead token.  This behavior is undocumented and Bison
     users should not rely upon it.  Assigning to YYVAL
     unconditionally makes the parser a bit smaller, and it avoids a
     GCC warning that YYVAL may be used uninitialized.  */
  yyval = yyvsp[1-yylen];

#if YYLSP_NEEDED
  /* Similarly for the default location.  Let the user run additional
     commands if for instance locations are ranges.  */
  yyloc = yylsp[1-yylen];
  YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
#endif

#if YYDEBUG
  /* We have to keep this `#if YYDEBUG', since we use variables which
     are defined only if `YYDEBUG' is set.  */
  if (yydebug)
    {
      int yyi;

      YYFPRINTF (stderr, "Reducing via rule %d (line %d), ",
		 yyn, yyrline[yyn]);

      /* Print the symbols being reduced, and their result.  */
      for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++)
	YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
      YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]);
    }
#endif

  switch (yyn) {

case 1:
#line 16 "test.y"
{printf("程序->分程序.\n");;
    break;}
case 2:
#line 20 "test.y"
{printf("分程序->常量说明部分 变量说明部分 过程说明部分 语句\n");;
    break;}
case 3:
#line 21 "test.y"
{printf("分程序->常量说明部分 变量说明部分 语句\n");;
    break;}
case 4:
#line 22 "test.y"
{printf("分程序->常量说明部分 语句\n");;
    break;}
case 5:
#line 23 "test.y"
{printf("分程序->常量说明部分 过程说明部分 语句\n");;
    break;}
case 6:
#line 24 "test.y"
{printf("分程序->变量说明部分 过程说明部分 语句\n");;
    break;}
case 7:
#line 25 "test.y"
{printf("分程序->变量说明部分 语句\n");;
    break;}
case 8:
#line 26 "test.y"
{printf("分程序->过程说明部分 语句\n");;
    break;}
case 9:
#line 27 "test.y"
{printf("分程序->语句\n");;
    break;}
case 10:
#line 31 "test.y"
{printf("常量说明部分->CONST 常量定义 常量定义串 ;\n");;
    break;}
case 11:
#line 32 "test.y"
{printf("常量说明部分->CONST 常量定义 ;\n");;
    break;}
case 12:
#line 36 "test.y"
{printf("常量定义串->常量定义串,常量定义\n");;
    break;}
case 13:
#line 37 "test.y"
{printf("常量定义串->,常量定义\n");;
    break;}
case 14:
#line 41 "test.y"
{printf("常量定义->ID := NUM\n");;
    break;}
case 15:
#line 45 "test.y"
{printf("变量说明部分->VAR ID 标识符串 ;\n");;
    break;}
case 16:
#line 46 "test.y"
{printf("变量说明部分->VAR ID ;\n");;
    break;}
case 17:
#line 50 "test.y"
{printf("标识符串->, ID\n");;
    break;}
case 18:
#line 51 "test.y"
{printf("标识符串->标识符串 , ID\n");;
    break;}
case 19:
#line 55 "test.y"
{printf("过程说明部分->过程首部 分程序 过程说明串 ;\n");;
    break;}
case 20:
#line 56 "test.y"
{printf("过程说明部分->过程首部 分程序 ;\n");;
    break;}
case 21:
#line 60 "test.y"
{printf("过程说明串->; 过程说明部分\n");;
    break;}
case 22:
#line 61 "test.y"
{printf("过程说明串->过程说明串 ; 过程说明部分\n");;
    break;}
case 23:
#line 65 "test.y"
{printf("过程首部->PROCEDURE ID ;\n");;
    break;}
case 24:
#line 69 "test.y"
{printf("语句->赋值语句\n");;
    break;}
case 25:
#line 70 "test.y"
{printf("语句->符合语句\n");;
    break;}
case 26:
#line 71 "test.y"
{printf("语句->条件语句\n");;
    break;}
case 27:
#line 72 "test.y"
{printf("语句->当型循环语句\n");;
    break;}
case 28:
#line 73 "test.y"
{printf("语句->过程调用语句\n");;
    break;}
case 29:
#line 74 "test.y"
{printf("语句->读语句\n");;
    break;}
case 30:
#line 75 "test.y"
{printf("语句->写语句\n");;
    break;}
case 31:
#line 76 "test.y"
{printf("语句->空\n");;
    break;}
case 32:
#line 80 "test.y"
{printf("赋值语句->ID := 表达式\n");;
    break;}
case 33:
#line 84 "test.y"
{printf("复合语句->BEGIN 语句 语句串 END\n");;
    break;}
case 34:
#line 85 "test.y"
{printf("复合语句->BEGIN 语句 END\n");;
    break;}
case 35:
#line 89 "test.y"
{printf("语句串->; 语句\n");;
    break;}
case 36:
#line 90 "test.y"
{printf("语句串->语句串 ; 语句\n");;
    break;}
case 37:
#line 94 "test.y"
{printf("条件->表达式 关系运算符 表达式\n");;
    break;}
case 38:
#line 95 "test.y"
{printf("条件->ODD 表达式\n");;
    break;}
case 39:
#line 99 "test.y"
{printf("条件语句->IF 条件 THEN 语句\n");;
    break;}
case 40:
#line 103 "test.y"
{printf("表达式->+ 项 加法和项的串\n");;
    break;}
case 41:
#line 104 "test.y"
{printf("表达式->- 项 加法和项的串\n");;
    break;}
case 42:
#line 105 "test.y"
{printf("表达式->项 加法和项的串\n");;
    break;}
case 43:
#line 106 "test.y"
{printf("表达式->项\n");;

⌨️ 快捷键说明

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