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

@@ -53,7 +53,6 @@ char *spec_defines_file = NULL; /* for --defines. */
char *parser_file_name = NULL;
char *infile = NULL;
char *attrsfile = NULL;
static char *full_base_name = NULL;
@@ -423,10 +422,10 @@ compute_output_file_names (void)
src_extension = ".c";
if (!header_extension)
header_extension = ".h";
parser_file_name =
spec_outfile ? spec_outfile : stringappend (full_base_name, src_extension);
/* It the defines filename if not given, we create it. */
if (!spec_defines_file)
spec_defines_file = stringappend (full_base_name, header_extension);
@@ -436,6 +435,4 @@ compute_output_file_names (void)
spec_graph_file = stringappend (short_base_name, ".vcg");
spec_verbose_file = stringappend (short_base_name, EXT_OUTPUT);
attrsfile = stringappend (short_base_name, EXT_STYPE_H);
}

View File

@@ -57,7 +57,6 @@ extern struct obstack post_prologue_obstack;
extern struct obstack output_obstack;
extern char *infile;
extern char *attrsfile;
void compute_output_file_names PARAMS((void));

View File

@@ -45,8 +45,6 @@ token_number_t start_symbol = 0;
int max_user_token_number = 256;
int semantic_parser = 0;
int pure_parser = 0;

View File

@@ -47,7 +47,7 @@
Therefore 0 cannot be used, since it would be both the rule number
0, and the token EOF).
Actions and guards are accessed via the rule number.
Actions are accessed via the rule number.
The rules themselves are described by several arrays: amongst which
RITEM, and RULES.
@@ -150,9 +150,6 @@ typedef struct rule_s
const char *action;
int action_line;
const char *guard;
int guard_line;
} rule_t;
extern struct rule_s *rules;
@@ -166,11 +163,6 @@ extern symbol_t **symbols;
extern token_number_t *token_translations;
extern int max_user_token_number;
/* SEMANTIC_PARSER is nonzero if the input file says to use the hairy
parser that provides for semantic error recovery. If it is zero,
the yacc-compatible simplified parser is used. */
extern int semantic_parser;
/* PURE_PARSER is nonzero if should generate a parser that is all pure
and reentrant. */

View File

@@ -36,7 +36,6 @@ typedef enum token_e
tok_percent_left_curly,
tok_token,
tok_nterm,
tok_guard,
tok_type,
tok_union,
tok_start,

View File

@@ -83,7 +83,6 @@ const struct option_table_struct option_table[] =
DRTV ("term", no, NULL, tok_token)
DRTV ("nterm", no, NULL, tok_nterm)
DRTV ("type", no, NULL, tok_type)
DRTV ("guard", no, NULL, tok_guard)
DRTV ("union", no, NULL, tok_union)
DRTV ("expect", no, NULL, tok_expect)
DRTV ("thong", no, NULL, tok_thong)
@@ -104,7 +103,6 @@ const struct option_table_struct option_table[] =
BOTH ("name-prefix", required, &spec_name_prefix, tok_stropt, 'p')
DRTV ("define", no, NULL, tok_define)
DRTV ("semantic-parser",no, &semantic_parser, tok_intopt)
DRTV ("pure-parser", no, &pure_parser, tok_intopt)
/*

View File

@@ -568,30 +568,6 @@ actions_output (FILE *out)
}
/*----------------------------.
| Output the guards to OOUT. |
`----------------------------*/
void
guards_output (FILE *out)
{
int rule;
for (rule = 1; rule < nrules + 1; ++rule)
if (rules[rule].guard)
{
fprintf (out, " case %d:\n", rule);
if (!no_lines_flag)
fprintf (out, muscle_find ("linef"),
rules[rule].guard_line,
quotearg_style (c_quoting_style,
muscle_find ("filename")));
fprintf (out, "{ %s; }\n break;\n\n",
rules[rule].guard);
}
}
/*---------------------------------------.
| Output the tokens definition to OOUT. |
`---------------------------------------*/
@@ -629,10 +605,6 @@ token_definitions_output (FILE *out)
fprintf (out, "%s [[[%s]], [%d]]",
first ? "" : ",\n", symbol->tag, number);
if (semantic_parser)
/* FIXME: This is probably wrong, and should be just as
above. --akim. */
fprintf (out, "# define T%s\t%d\n", symbol->tag, symbol->number);
first = 0;
}
}
@@ -1020,10 +992,6 @@ output_skeleton (void)
actions_output (out);
fputs ("]])\n\n", out);
fputs ("m4_define([b4_guards], \n[[", out);
guards_output (out);
fputs ("]])\n\n", out);
fputs ("m4_define([b4_tokens], \n[", out);
token_definitions_output (out);
fputs ("])\n\n", out);
@@ -1099,12 +1067,7 @@ prepare (void)
/* Find the right skeleton file. */
if (!skeleton)
{
if (semantic_parser)
skeleton = "bison.hairy";
else
skeleton = "bison.simple";
}
skeleton = "bison.simple";
/* Parse the skeleton file and output the needed parsers. */
muscle_insert ("skeleton", skeleton);

View File

@@ -27,7 +27,6 @@ extern int error_verbose;
void output PARAMS ((void));
void actions_output PARAMS ((FILE *out));
void guards_output PARAMS ((FILE *out));
void token_definitions_output PARAMS ((FILE *out));
extern struct obstack muscle_obstack;

View File

@@ -45,9 +45,6 @@ typedef struct symbol_list
const char *action;
int action_line;
/* The guard is attached to the LHS of a rule. */
const char *guard;
int guard_line;
symbol_t *ruleprec;
} symbol_list;
@@ -80,8 +77,6 @@ symbol_list_new (symbol_t *sym)
res->line = lineno;
res->action = NULL;
res->action_line = 0;
res->guard = NULL;
res->guard_line = 0;
res->ruleprec = NULL;
return res;
}
@@ -1273,9 +1268,7 @@ read_declarations (void)
| values in the current rule so far, which says where to find `$0' |
| with respect to the top of the stack. |
| |
| This routine is used both for actions and guards. Only |
| ACTION_OBSTACK is used, but this is fine, since we use only |
| pointers to relevant portions inside this obstack. |
| This routine is used for actions. |
`------------------------------------------------------------------*/
static void
@@ -1341,18 +1334,6 @@ parse_action (symbol_list *rule, int rule_length)
rule->action = obstack_finish (&action_obstack);
}
static void
parse_guard (symbol_list *rule, int rule_length)
{
token_t t = lex ();
if (t != tok_left_curly)
complain (_("invalid %s declaration"), "%guard");
rule->guard_line = lineno;
parse_braces (rule, rule_length);
rule->guard = obstack_finish (&action_obstack);
}
/*-------------------------------------------------------------------.
@@ -1384,8 +1365,8 @@ gensym (void)
| null pointer instead of a symbol to terminate the rule. The next |
| symbol is the lhs of the following rule. |
| |
| All guards and actions are copied out to the appropriate files, |
| labelled by the rule number they apply to. |
| All actions are copied out, labelled by the rule number they apply |
| to. |
| |
| Bison used to allow some %directives in the rules sections, but |
| this is no longer consider appropriate: (i) the documented grammar |
@@ -1582,15 +1563,6 @@ readgram (void)
t = lex ();
}
if (t == tok_guard)
{
if (!semantic_parser)
complain (_("%%guard present but %%semantic_parser not specified"));
parse_guard (crule, rulelength);
t = lex ();
}
if (t == tok_left_curly)
{
/* This case never occurs -wjh */
@@ -1791,8 +1763,6 @@ packgram (void)
rules[ruleno].useful = TRUE;
rules[ruleno].action = p->action;
rules[ruleno].action_line = p->action_line;
rules[ruleno].guard = p->guard;
rules[ruleno].guard_line = p->guard_line;
p = p->next;
while (p && p->sym)
@@ -1829,13 +1799,12 @@ packgram (void)
ritem_print (stderr);
}
/*-------------------------------------------------------------------.
| Read in the grammar specification and record it in the format |
| described in gram.h. All guards are copied into the GUARD_OBSTACK |
| and all actions into ACTION_OBSTACK, in each case forming the body |
| of a C function (YYGUARD or YYACTION) which contains a switch |
| statement to decide which guard or action to execute. |
`-------------------------------------------------------------------*/
/*------------------------------------------------------------------.
| Read in the grammar specification and record it in the format |
| described in gram.h. All actions are copied into ACTION_OBSTACK, |
| in each case forming the body of a C function (YYACTION) which |
| contains a switch statement to decide which action to execute. |
`------------------------------------------------------------------*/
void
reader (void)
@@ -1889,7 +1858,7 @@ reader (void)
}
/* Read in the grammar, build grammar in list form. Write out
guards and actions. */
actions. */
readgram ();
/* Some C code is given at the end of the grammar file. */
read_additionnal_code ();

View File

@@ -24,10 +24,7 @@
#include "symtab.h"
/* Read in the grammar specification and record it in the format
described in gram.h. All guards are copied into the FGUARD file
and all actions into FACTION, in each case forming the body of a C
function (YYGUARD or YYACTION) which contains a switch statement to
decide which guard or action to execute. */
described in gram.h. */
void reader PARAMS ((void));

View File

@@ -238,21 +238,15 @@ do { \
/* VMS. */
# define EXT_TAB "_tab"
# define EXT_OUTPUT ".output"
# define EXT_STYPE_H "_stype"
# define EXT_GUARD_C "_guard"
#else /* ! VMS */
# ifdef MSDOS
/* MS DOS. */
# define EXT_TAB "_tab"
# define EXT_OUTPUT ".out"
# define EXT_STYPE_H ".sth"
# define EXT_GUARD_C ".guc"
# else /* ! MSDOS */
/* Standard. */
# define EXT_TAB ".tab"
# define EXT_OUTPUT ".output"
# define EXT_STYPE_H ".stype"
# define EXT_GUARD_C ".guard"
# endif /* ! MSDOS */
#endif /* ! VMS */