Remove the so called hairy (semantic) parsers.

* src/system.h (EXT_GUARD_C, EXT_STYPE_H): Remove.
* src/gram.h, src/gram.c (semantic_parser): Remove.
(rule_t): Remove the guard and guard_line members.
* src/lex.h (token_t): remove tok_guard.
* src/options.c (option_table): Remove %guard and %semantic_parser
support.
* src/output.c, src/output.h (guards_output): Remove.
(prepare): Adjust.
(token_definitions_output): Don't output the `T'
tokens (???).
(output_skeleton): Don't output the guards.
* src/files.c, src/files.c (attrsfile): Remove.
* src/reader.c (symbol_list): Remove the guard and guard_line
members.
Adjust dependencies.
(parse_guard): Remove.
* data/bison.hairy: Remove.
* doc/bison.texinfo (Environment Variables): Remove occurrences of
BISON_HAIRY.
This commit is contained in:
Akim Demaille
2002-05-02 15:06:46 +00:00
parent 64bd62a1be
commit fdbcd8e289
21 changed files with 49 additions and 512 deletions

View File

@@ -1,4 +1,4 @@
## Copyright 2002 Free Software Foundation, Inc.
## Copyright (C) 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
@@ -15,7 +15,7 @@
## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
## 02111-1307 USA
dist_pkgdata_DATA = bison.simple bison.hairy bison.c++
dist_pkgdata_DATA = bison.simple bison.c++
m4sugardir = $(pkgdatadir)/m4sugar
dist_m4sugar_DATA = m4sugar/m4sugar.m4 m4sugar/version.m4

View File

@@ -1,336 +0,0 @@
%%{section} %%{output-prefix} %%{output-infix} %%".c"
/* -*- C -*- */
/* YYERROR and YYCOST are set by guards. If yyerror is set to a
nonzero value by a guard, the reduction with which the guard is
associated is not performed, and the error recovery mechanism is
invoked. Yycost indicates the cost of performing the reduction
given the attributes of the symbols. */
static int yyerror;
static int yycost;
/* YYMAXDEPTH indicates the size of the parser's state and value
stacks. */
#ifndef YYMAXDEPTH
# define YYMAXDEPTH 500
#endif
/* YYMAXRULES must be at least as large as the number of rules that
could be placed in the rule queue. That number could be determined
from the grammar and the size of the stack, but, as yet, it is not.
*/
#ifndef YYMAXRULES
# define YYMAXRULES 100
#endif
#ifndef YYMAXBACKUP
# define YYMAXBACKUP 100
#endif
/* The state stack. */
static short yyss[YYMAXDEPTH];
/* The semantic value stack. */
static YYSTYPE yyvs[YYMAXDEPTH];
/* The location stack. */
static YYLTYPE yyls[YYMAXDEPTH];
/* The rule queue. */
static short yyrq[YYMAXRULES];
/* The lookahead symbol. */
static int yychar;
/* the semantic value of the lookahead symbol. */
static YYSTYPE yylval;
/* the semantic value for the state at the top of the state stack. */
static YYSTYPE yytval;
/* the variable used to return semantic values from the action
routines. */
static YYSTYPE yyval;
/* location data for the lookahead symbol. */
static YYLTYPE yylloc;
/* location data for the state at the top of the state stack. */
static YYLTYPE yytloc;
static int yynunlexed;
static short yyunchar[YYMAXBACKUP];
static YYSTYPE yyunval[YYMAXBACKUP];
static YYLTYPE yyunloc[YYMAXBACKUP];
/* a pointer to the top of the state stack; only set during error
recovery. */
static short *yygssp;
/* a pointer to the top of the value stack; only set during error
recovery. */
static YYSTYPE *yygvsp;
/* a pointer to the top of the location stack; only set during error
recovery. */
static YYLTYPE *yyglsp;
/*--------------------------------------------------------------------.
| Yyget is an interface between the parser and the lexical analyzer. |
| It is costly to provide such an interface, but it avoids requiring |
| the lexical analyzer to be able to back up the scan. |
`--------------------------------------------------------------------*/
static inline void
yyget (void)
{
if (yynunlexed > 0)
{
yynunlexed--;
yychar = yyunchar[yynunlexed];
yylval = yyunval[yynunlexed];
yylloc = yyunloc[yynunlexed];
}
else if (yychar <= 0)
yychar = 0;
else
{
yychar = yylex ();
if (yychar < 0)
yychar = 0;
else
yychar = YYTRANSLATE (yychar);
}
}
static inline void
yyunlex (int chr, YYSTYPE val, YYLTYPE loc)
{
yyunchar[yynunlexed] = chr;
yyunval[yynunlexed] = val;
yyunloc[yynunlexed] = loc;
yynunlexed++;
}
static inline void
yyrestore (short *first, short *last)
{
short *ssp;
short *rp;
int symbol;
int state;
int tvalsaved;
ssp = yygssp;
yyunlex (yychar, yylval, yylloc);
tvalsaved = 0;
while (first != last)
{
symbol = yystos[*ssp];
if (symbol < YYNTBASE)
{
yyunlex (symbol, yytval, yytloc);
tvalsaved = 1;
ssp--;
}
ssp--;
if (first == yyrq)
first = yyrq + YYMAXRULES;
first--;
for (rp = yyrhs + yyprhs[*first]; symbol = *rp; rp++)
{
if (symbol < YYNTBASE)
state = yytable[yypact[*ssp] + symbol];
else
{
state = yypgoto[symbol - YYNTBASE] + *ssp;
if (state >= 0 && state <= YYLAST && yycheck[state] == *ssp)
state = yytable[state];
else
state = yydefgoto[symbol - YYNTBASE];
}
*++ssp = state;
}
}
if (!tvalsaved && ssp > yyss)
{
yyunlex (yystos[*ssp], yytval, yytloc);
ssp--;
}
yygssp = ssp;
}
int
yyparse (void)
{
int yystate;
int yyn;
short *yyssp;
short *yyrq0;
short *yyptr;
YYSTYPE *yyvsp;
int yylen;
YYLTYPE *yylsp;
short *yyrq1;
short *yyrq2;
yystate = 0;
yyssp = yyss - 1;
yyvsp = yyvs - 1;
yylsp = yyls - 1;
yyrq0 = yyrq;
yyrq1 = yyrq0;
yyrq2 = yyrq0;
yychar = yylex ();
if (yychar < 0)
yychar = 0;
else
yychar = YYTRANSLATE (yychar);
yynewstate:
if (yyssp >= yyss + YYMAXDEPTH - 1)
{
yyabort ("Parser Stack Overflow");
YYABORT;
}
*++yyssp = yystate;
yyresume:
yyn = yypact[yystate];
if (yyn == YYFLAG)
goto yydefault;
yyn += yychar;
if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar)
goto yydefault;
yyn = yytable[yyn];
if (yyn < 0)
{
yyn = -yyn;
goto yyreduce;
}
else if (yyn == 0)
goto yyerrlab;
yystate = yyn;
yyptr = yyrq2;
while (yyptr != yyrq1)
{
yyn = *yyptr++;
yylen = yyr2[yyn];
yyvsp -= yylen;
yylsp -= yylen;
yyguard (yyn, yyvsp, yylsp);
if (yyerror)
goto yysemerr;
yyaction (yyn, yyvsp, yylsp);
*++yyvsp = yyval;
yylsp++;
if (yylen == 0)
{
yylsp->first_line = yytloc.first_line;
yylsp->first_column = yytloc.first_column;
yylsp->last_line = (yylsp - 1)->last_line;
yylsp->last_column = (yylsp - 1)->last_column;
yylsp->text = 0;
}
else
{
yylsp->last_line = (yylsp + yylen - 1)->last_line;
yylsp->last_column = (yylsp + yylen - 1)->last_column;
}
if (yyptr == yyrq + YYMAXRULES)
yyptr = yyrq;
}
if (yystate == YYFINAL)
YYACCEPT;
yyrq2 = yyptr;
yyrq1 = yyrq0;
*++yyvsp = yytval;
*++yylsp = yytloc;
yytval = yylval;
yytloc = yylloc;
yyget ();
goto yynewstate;
yydefault:
yyn = yydefact[yystate];
if (yyn == 0)
goto yyerrlab;
yyreduce:
*yyrq0++ = yyn;
if (yyrq0 == yyrq + YYMAXRULES)
yyrq0 = yyrq;
if (yyrq0 == yyrq2)
{
yyabort ("Parser Rule Queue Overflow");
YYABORT;
}
yyssp -= yyr2[yyn];
yyn = yyr1[yyn];
yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
yystate = yytable[yystate];
else
yystate = yydefgoto[yyn - YYNTBASE];
goto yynewstate;
yysemerr:
*--yyptr = yyn;
yyrq2 = yyptr;
yyvsp += yyr2[yyn];
yyerrlab:
yygssp = yyssp;
yygvsp = yyvsp;
yyglsp = yylsp;
yyrestore (yyrq0, yyrq2);
yyrecover ();
yystate = *yygssp;
yyssp = yygssp;
yyvsp = yygvsp;
yyrq0 = yyrq;
yyrq1 = yyrq0;
yyrq2 = yyrq0;
goto yyresume;
}
%%{actions}

View File

@@ -116,8 +116,8 @@ m4_divert(0)dnl
/* 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. */
It was written by Richard Stallman by simplifying the original so
called ``semantic'' parser. */
/* All symbols defined below should begin with yy or YY, to avoid
infringing on user name space. This should be done even for local