Commit Graph

1186 Commits

Author SHA1 Message Date
Paul Hilfinger
ba29c4ec25 Renaming file to glr.c. 2002-06-28 01:50:29 +00:00
Akim Demaille
e2aaf4c4f9 * src/options.h, src/options.c: Remove.
* src/getargs.c (short_options, long_options): New.
2002-06-27 12:19:20 +00:00
Akim Demaille
7cca31a2f2 Update. 2002-06-27 12:18:03 +00:00
Akim Demaille
60491a948b * data/bison.simple, data/bison.c++: Rename as...
* data/yacc.c, data/lalr1.cc: these.
* doc/bison.texinfo (Environment Variables): Remove.
2002-06-27 12:08:20 +00:00
Akim Demaille
2a10b47aaf Update. 2002-06-27 11:56:03 +00:00
Paul Hilfinger
12bebc0445 New file: Tests for GLR parsing. 2002-06-26 22:52:27 +00:00
Paul Hilfinger
febef6caec New file: skeleton for GLR (Generalized LR) parser. 2002-06-26 22:51:51 +00:00
Akim Demaille
9be0c25bf0 * src/getargs.c (report_argmatch): Initialize strtok(). 2002-06-25 12:05:38 +00:00
Akim Demaille
976e627098 Update. 2002-06-20 12:23:54 +00:00
Akim Demaille
3424c3868f Update. 2002-06-20 12:19:42 +00:00
Akim Demaille
1ae7286376 * data/bison.simple (b4_symbol_actions): New, replaces...
(b4_symbol_destructor, b4_symbol_printer): these.
(yysymprint): Be sure to call YYPRINT only for tokens, and using
user token numbers.
2002-06-20 11:46:59 +00:00
Akim Demaille
87542d29a5 * data/bison.simple (yydestructor): Rename as...
(yydestruct): this.
2002-06-20 11:28:33 +00:00
Akim Demaille
1a31ed21b1 * src/symtab.h, src/symtab.c (symbol_type_set)
(symbol_destructor_set, symbol_precedence_set): The location is
the last argument.
Adjust all callers.
2002-06-20 11:20:25 +00:00
Akim Demaille
e776192e4f * src/parse-gram.y (YYPRINT, yyprint): Don't mess with the parser
internals.
* src/reader.h, src/reader.c (grammar_current_rule_prec_set):
Takes a location.
* src/symtab.h, src/symtab.c (symbol_class_set)
(symbol_user_token_number_set): Likewise.
Adjust all callers.
Promote complain_at.
* tests/input.at (Type Clashes): Adjust.
2002-06-20 11:10:56 +00:00
Akim Demaille
5c1180b3c4 * data/bison.simple (YYLEX): Fix the declaration when
%pure-parser.
2002-06-20 10:29:27 +00:00
Akim Demaille
e317006080 * data/bison.simple (yysymprint): Don't print the token number,
just its name.
* tests/actions.at (Destructors): Rename as...
(Printers and Destructors): this.
Also exercise %printer.
2002-06-20 09:47:44 +00:00
Akim Demaille
253862fd4c * data/bison.simple (YYDSYMPRINT): New.
Use it to remove many of the #if YYDEBUG/if (yydebug).
2002-06-20 09:22:56 +00:00
Akim Demaille
366eea36d3 * src/symtab.h, src/symtab.c (symbol_t): printer and
printer_location are new members.
(symbol_printer_set): New.
* src/parse-gram.y (PERCENT_PRINTER): New token.
Handle its associated rule.
* src/scan-gram.l: Adjust.
(handle_destructor_at, handle_destructor_dollar): Rename as...
(handle_symbol_code_at, handle_symbol_code_dollar): these.
* src/output.c (symbol_printers_output): New.
(output_skeleton): Call it.
* data/bison.simple (yysymprint): New.  Cannot be named yyprint
since there are already many grammar files with a user `yyprint'.
Replace the calls to YYPRINT to calls to yysymprint.
* tests/calc.at: Adjust.
* tests/torture.at (AT_DATA_STACK_TORTURE): Remove YYPRINT: it was
taking advantage of parser very internal details (stack size!).
2002-06-20 09:08:37 +00:00
Akim Demaille
1ce5149ac8 Regen. 2002-06-20 09:05:10 +00:00
Akim Demaille
4f25ebb043 * src/scan-gram.l: Complete the scanner with the missing patterns
to pacify Flex.
Use `quote' and `symbol_tag_get' where appropriate.
2002-06-20 07:19:13 +00:00
Akim Demaille
93b68a0e09 * tests/actions.at (Destructors): Augment to test locations.
* data/bison.simple (yydestructor): Pass it the current location
if locations are enabled.
Prototype only when __STDC__ or C++.
Change the argument names to move into the yy name space: there is
user code here.
2002-06-19 12:03:22 +00:00
Akim Demaille
7431029172 * data/bison.simple (b4_pure_if): New.
Use it instead of #ifdef YYPURE.
2002-06-19 10:00:24 +00:00
Akim Demaille
58612f1de0 * data/bison.simple (m4_location_if): New.
Use it instead of #ifdef YYLSP_NEEDED.
2002-06-19 09:07:36 +00:00
Akim Demaille
02097d3eab Regen. 2002-06-19 09:02:43 +00:00
Akim Demaille
f25bfb75aa Prepare @$ in %destructor, but currently don't bind it in the
skeleton, as %location use is not cleaned up yet.
* src/scan-gram.l (handle_dollar, handle_destructor_at)
(handle_action_at): New.
(handle_at, handle_action_dollar, handle_destructor_dollar): Take
a braced_code_t and a location as additional arguments.
(handle_destructor_dollar): Instead of requiring `b4_eval', just
unquote one when outputting `b4_dollar_dollar'.
Adjust callers.
* data/bison.simple (b4_eval): Remove.
(b4_symbol_destructor): Adjust.
* tests/input.at (Invalid @n): Adjust.
2002-06-19 08:22:49 +00:00
Akim Demaille
c732d2c6dc * doc/bison.texinfo: Document ability to have multiple
prologue sections.
2002-06-19 07:46:11 +00:00
Akim Demaille
8c165d891d * src/files.c (compute_base_names): When computing the output file
names from the input file name, strip the directory part.
2002-06-18 12:39:54 +00:00
Akim Demaille
ca98bf5758 * data/bison.simple.new: Comment changes.
Reported by Andreas Schwab.
2002-06-18 11:37:20 +00:00
Akim Demaille
0bfb02fff7 * data/bison.simple (yyoverflowlab): #ifndef yyoverflow, so that
there are no `label `yyoverflowlab' defined but not used' warnings
when yyoverflow is defined.
2002-06-18 10:00:36 +00:00
Akim Demaille
24c0aad7e7 * src/symtab.h, src/symtab.c (symbol_t): destructor_location is a
new member.
(symbol_destructor_set): Adjust.
* src/output.c (symbol_destructors_output): Output the destructor
locations.
Output the symbol name.
* data/bison.simple (b4_symbol_destructor): Adjust.
2002-06-18 09:55:35 +00:00
Akim Demaille
5719c1092f and Akim Demaille <akim@epita.fr>
* data/bison.simple.new (yyerrlab1): Be sure to pop and destroy
what's left on the stack when the error recovery hits EOF.
* tests/actions.at (Destructors): Complete to exercise this case.
2002-06-18 09:12:58 +00:00
Akim Demaille
271efced67 Update. 2002-06-17 18:04:11 +00:00
Akim Demaille
abd741b1f6 Regen. 2002-06-17 08:44:05 +00:00
Akim Demaille
9280d3ef89 * data/m4sugar/m4sugar.m4 (m4_map): Recognize when the list of
arguments is really empty, not only equal to `[]'.
* src/symtab.h, src/symtab.c (symbol_t): `destructor' is a new
member.
(symbol_destructor_set): New.
* src/output.c (symbol_destructors_output): New.
* src/reader.h (brace_code_t, current_braced_code): New.
* src/scan-gram.l (BRACED_CODE): Use it to branch on...
(handle_dollar): Rename as...
(handle_action_dollar): this.
(handle_destructor_dollar): New.
* src/parse-gram.y (PERCENT_DESTRUCTOR): New.
(grammar_declaration): Use it.
* data/bison.simple (yystos): Is always defined.
(yydestructor): New.
* tests/actions.at (Destructors): New.
* tests/calc.at (_AT_CHECK_CALC_ERROR): Don't rely on egrep.
2002-06-17 08:43:12 +00:00
Akim Demaille
dafdc66ff0 * src/symlist.h, src/symlist.c (symbol_list_length): New.
* src/scan-gram.l (handle_dollar, handle_at): Compute the
rule_length only when needed.
* src/output.c (actions_output, token_definitions_output): Output
the full M4 block.
* src/symtab.c: Don't access directly to the symbol tag, use
symbol_tag_get.
* src/parse-gram.y: Use symbol_list_free.
2002-06-17 07:05:12 +00:00
Akim Demaille
56c4720342 * src/reader.h, src/reader.c (symbol_list, symbol_list_new)
(symbol_list_prepend, get_type_name): Move to...
* src/symlist.h, src/symlist.c (symbol_list_t, symbol_list_new)
(symbol_list_prepend, symbol_list_n_type_name_get): here.
Adjust all callers.
(symbol_list_free): New.
* src/scan-gram.l (handle_dollar): Takes a location.
* tests/input.at (Invalid $n): Adjust.
2002-06-17 07:04:49 +00:00
Akim Demaille
1e0bab9276 * src/reader.h, src/reader.c (symbol_list_new): Export it.
(symbol_list_prepend): New.
* src/parse-gram.y (%union): `list' is a new member.
(symbols.1): New, replaces...
(terms_to_prec.1, nterms_to_type.1): these.
* src/symtab.h, src/symtab.c (symbol_type_set, symbol_precedence_set)
Take a location as additional argument.
Adjust all callers.
2002-06-17 07:04:24 +00:00
Akim Demaille
74886d31e7 Regen. 2002-06-15 18:27:15 +00:00
Akim Demaille
04e6065479 * src/parse-gram.y: Move %token in the declaration section so that
we don't depend upon CVS Bison.
2002-06-15 18:26:45 +00:00
Akim Demaille
10e5b8bd0a * src/state.h, src/state.c (state_rule_lookaheads_print): New.
* src/print.c (print_core): Use it.
2002-06-15 18:24:25 +00:00
Akim Demaille
9801d40c50 * src/conflicts.c (log_resolution): Accept the rule involved in
the sr conflicts instead of the lookahead number that points to
that rule.
(flush_reduce): Accept the current lookahead vector as argument,
instead of the index in LA.
(resolve_sr_conflict): Accept the current number of lookahead
bitset to consider for the STATE, instead of the index in LA.
(set_conflicts): Adjust.
* src/lalr.c, src/lalr.h, src/state.h: Comment changes.
2002-06-15 18:24:08 +00:00
Akim Demaille
c026349221 * src/state.h (state_t): Replace the `lookaheadsp' member, a
short, with `lookaheads' (bitsetv), `lookaheads_rule' (rule_t**).
Adjust all dependencies.
* src/lalr.c (initialize_lookaheads): Split into...
(states_lookaheads_count, states_lookaheads_initialize): these.
(lalr): Adjust.
2002-06-15 18:23:50 +00:00
Akim Demaille
9757c359ef * src/gram.h, src/gram.c (grammar_rules_partial_print): New, eved
out of...
(grammar_rules_print): here.
* src/reduce.c (reduce_output): Use it.
* tests/reduce.at (Useless Rules, Reduced Automaton)
(Underivable Rules): Adjust.
2002-06-15 18:23:33 +00:00
Akim Demaille
6b98e4b563 Copy BYacc's nice way to report the grammar.
* src/gram.h, src/gram.c (grammar_rhs_print, grammar_rules_print):
New.
Don't print the rules' location, it is confusing and useless.
(rule_print): Use grammar_rhs_print.
* src/print.c (print_grammar): Use grammar_rules_print.
2002-06-15 18:23:12 +00:00
Akim Demaille
ee000ba4fc Let symbols have a location.
* src/symtab.h, src/symtab.c (symbol_t): Location is a new member.
(getsym): Adjust.
Adjust all callers.
* src/complain.h, src/complain.c (complain_at, fatal_at, warn_at):
Use location_t, not int.
* src/symtab.c (symbol_check_defined): Take advantage of the
location.
* tests/regression.at (Invalid inputs): Adjust.
2002-06-15 18:21:46 +00:00
Akim Demaille
8efe435c05 * src/parse-gram.y (YYLLOC_DEFAULT, current_lhs_location): New.
(input): Don't try to initialize yylloc here, do it in the
scanner.
* src/scan-gram.l (YY_USER_INIT): Initialize yylloc.
* src/gram.h (rule_t): Change line and action_line into location
and action_location, of location_t type.
Adjust all dependencies.
* src/location.h, src/location.c (empty_location): New.
* src/reader.h, src/reader.c (grammar_start_symbol_set)
(grammar_symbol_append, grammar_rule_begin, grammar_rule_end)
(grammar_current_rule_symbol_append)
(grammar_current_rule_action_append): Expect a location as argument.
* src/reader.c (grammar_midrule_action): Adjust to attach an
action's location as dummy symbol location.
* src/symtab.h, src/symtab.c (startsymbol_location): New.
* tests/regression.at (Web2c Report, Rule Line Numbers): Adjust
the line numbers.
2002-06-15 18:21:11 +00:00
Akim Demaille
4f6bb8b24b Formatting changes. 2002-06-14 17:39:10 +00:00
Akim Demaille
1921f1d7a4 Grammar declarations may be found in the grammar section.
* src/parse-gram.y (rules_or_grammar_declaration): New.
(declarations): Each declaration may end with a semicolon, not
just...
(grammar_declaration): `"%union"'.
(grammar): Branch to rules_or_grammar_declaration.
2002-06-14 17:38:14 +00:00
Akim Demaille
4515534cd2 * src/main.c (main): Invoke scanner_free. 2002-06-14 17:37:12 +00:00
Akim Demaille
f958596b44 * src/output.c (m4_invoke): Extracted from...
(output_skeleton): here.
Free tempfile.
2002-06-14 17:36:58 +00:00