Commit Graph

2457 Commits

Author SHA1 Message Date
Akim Demaille
99880de508 Use more STL like names: my_class instead of MyClass.
* data/lalr1.cc (LocationStack, LocationType, RhsNumberType)
(SemanticStack, SemanticType, StateStack, StateType)
(TokenNumberType, Stack, Slice, Traits, Parser::location)
(Parser::value): Rename as...
(location_stack, location_type, rhs_number_type, semantic_stack)
(semantic_type, state_stack, state_type, token_number_type, stack)
(slice, traits, parser::yylloc, parser::yylval): these.
* tests/calc.at, tests/regression.at, tests/actions.at: Adjust.
2004-12-20 13:56:38 +00:00
Paul Eggert
9bec482e39 (YYLLOC_DEFAULT): Use GNU spacing conventions. 2004-12-20 03:44:10 +00:00
Paul Eggert
f6fbd3da9d Remove uses of 'short int' and 'unsigned short int' in the parser generators.
* src/LR0.c (allocate_itemsets, new_itemsets, save_reductions):
Use size_t, not int or short int, to count objects.
* src/closure.c (nritemset, closure): Likewise.
* src/closure.h (nritemset, closure): Likewise.
* src/nullable.c (nullable_compute): Likewise.
* src/print.c (print_core): Likewise.
* src/print_graph.c (print_core): Likewise.
* src/state.c (state_compare, state_hash): Likewise.
* src/state.h (struct state): Likewise.
* src/tables.c (default_goto, goto_actions): Likewise.

* src/gram.h (rule_number, rule): Use int, not short int.
* src/output.c (prepare_rules): Likewise.
* src/state.h (state_number, STATE_NUMBER_MAXIMUM, transitions,
errs, reductions): Likewise.
* src/symtab.h (symbol_number, SYMBOL_NUMBER_MAXIMUM, struct symbol):
Likewise.
* src/tables.c (vector_number, tally, action_number,
ACTION_NUMBER_MINIMUM): Likewise.
* src/output.c (muscle_insert_short_int_table): Remove.
2004-12-17 20:29:19 +00:00
Akim Demaille
efeed02327 * data/lalr1.cc: Extensive Doxygenation.
(error_): Rename as...
(error): this, since it is visible to the user.
Adjust callers.
(Parser::message): Now an automatic variable from...
(Parser::yyreport_syntax_error_): here.
* tests/actions.at, tests/calc.at, tests/regression.at: Adjust to
Parser::error.
* tests/input.at: Escape $.
2004-12-17 15:24:32 +00:00
Paul Eggert
76dcf299b7 Regenerate. 2004-12-16 20:42:40 +00:00
Paul Eggert
bc82c5a593 * data/glr.c (b4_lhs_value, b4_rhs_value, b4_rhs-location):
Parenthesize rhs to avoid obscure problems with mistakes like
"foo$$bar = foo$1bar;".  Problem reported by twlevo at xs4all.
* data/lalr1.cc (b4_lhs_value, b4_rhs_value, b4_lhs_location,
b4_rhs_location): Likewise.
* data/yacc.c (b4_lhs_value, b4_rhs_value, b4_lhs_location,
b4_rhs_location): Likewise.
2004-12-16 20:41:54 +00:00
Akim Demaille
fd19f2714f * data/lalr1.cc (yyreport_syntax_error_): Catch up with glr.c and
yacc.c: be sure to stay within yycheck_.
* tests/actions.at: Re-enable C++ tests.
2004-12-16 14:39:42 +00:00
Akim Demaille
10454ea42f * src/print_graph.c (print_graph): Remove layoutalgorithm uses for
real.
2004-12-16 09:09:56 +00:00
Akim Demaille
c5b95ccf6b Use #define to handle the %name-prefix.
* data/glr.c, data/yacc.c: Comment changes.
* data/lalr1.cc (yylex): Use #define to select the name of yylex,
so that one can refer to yylex in the parser file, and have it
renamed, as is the case with other skeletons.
2004-12-16 09:06:08 +00:00
Akim Demaille
617a8f1227 Move lalr1.cc internals into yy*.
* data/lalr1.cc (semantic_stack_, location_stack_, state_stack_)
(semantic_stack_, location_stack_, pact_, pact_ninf_, defact_)
(pgoto_, defgoto_, table_, table_ninf_, check_, stos_, r1_, r2_)
(name_, rhs_, prhs_, rline_, token_number_, eof_, last_, nnts_)
(empty_, final_, terror_, errcode_, ntokens_)
(user_token_number_max_, undef_token_, n_, len_, state_, nerrs_)
(looka_, ilooka_, error_range_, nerrs_):
Rename as...
(yysemantic_stack_, yylocation_stack_, yystate_stack_)
(yysemantic_stack_, yylocation_stack_, yypact_, yypact_ninf_)
(yydefact_, yypgoto_, yydefgoto_, yytable_, yytable_ninf_)
(yycheck_, yystos_, yyr1_, yyr2_, yyname_, yyrhs_, yyprhs_)
(yyrline_, yytoken_number_, yyeof_, yylast_, yynnts_, yyempty_)
(yyfinal_, yyterror_, yyerrcode_, yyntokens_)
(yyuser_token_number_max_, yyundef_token_, yyn_, yylen_, yystate_)
(yynerrs_, yylooka_, yyilooka_, yyerror_range_, yynerrs_):
these.
2004-12-16 08:48:54 +00:00
Paul Eggert
1e547e6e8c Fix some problems reported by twlevo at xs4all. 2004-12-16 00:09:28 +00:00
Paul Eggert
ea193b9dae * src/vcg.h (enum layoutalgorithm): Remove. All uses removed.
(struct node, struct graph):
Rename member expand to stretch.  All uses changed.
(struct graph): Remove member layoutalgorithm.  All uses removed.
* src/vcg.c (get_layoutalgorithm_str): Remove.  All uses removed.
* src/vcg_defaults.h (G_STRETCH): Renamed from G_EXPAND.
All uses changed.
(N_STRETCH): Rename from N_EXPAND.  All uses changed.
2004-12-16 00:09:08 +00:00
Paul Eggert
3239db74b1 (symbol_new): Report an error if the input grammar contains too many
symbols.
2004-12-16 00:08:21 +00:00
Akim Demaille
735d6bd42e The ChangeLog of the previous patch. 2004-12-15 17:42:18 +00:00
Akim Demaille
f69a414266 * data/lalr1.cc (lex_): Rename as...
(yylex_): this.
Move the trace here.
Take the %name-prefix into account.
Reported by Alexandre Duret-Lutz.
2004-12-15 17:38:37 +00:00
Akim Demaille
2e1f5829ee * data/lalr1.cc (lex_): Rename as...
(yylex_): this.
Move the trace here.
Take the %name-prefix into account.
Reported by Alexandre Duret-Lutz.
2004-12-15 16:30:15 +00:00
Akim Demaille
a3cb624893 Simplify the C++ parser constructor.
* data/lalr1.cc (debug_): Rename as...
(yydebug_): so that the parser's internals are always in the yy*
pseudo namespace.
Adjust uses.
(b4_parse_param_decl): Remove the leading comma as it is now only
called as unique argument list.
(Parser::Parser): Remove the constructor accepting a location and
an initial debugging level.
Remove from the other ctor the argument for the debugging level.
(debug_level_type, debug_level, set_debug_level): New.
* tests/actions.at, tests/calc.at, tests/regression.at: Adjust
constructor calls.
2004-12-15 16:18:12 +00:00
Akim Demaille
07fed89197 Remove b4_root related material: failure experiment
(which goal was to allow to derive from an class).
* data/lalr1.cc (b4_root, b4_param, b4_constructor): Remove
definitions and uses.
2004-12-15 15:35:17 +00:00
Paul Eggert
e603eaa5d4 * data/glr.c: Fix yyerror_range usage. 2004-12-14 18:49:09 +00:00
Paul Eggert
63d72da75b (struct yyGLRStack): yyerror_range now has 3 items,
not 2, since it's not portable to subtract 1 from the start of an
array.  The new item 0 is never set or used.  All uses changed.

(yyrecoverSyntaxError): Use YYLLOC_DEFAULT instead of assuming
the default definition of YYLLOC_DEFAULT.  Problem reported
by Frank Heckenbach.
2004-12-14 18:48:42 +00:00
Paul Eggert
bbd3fa0c61 Regenerate. 2004-12-12 09:29:18 +00:00
Paul Eggert
fafb007d45 Fix YYRHSLOC problem reported by Frank Heckenbach. 2004-12-12 09:26:07 +00:00
Paul Eggert
9fafc4ddfd (YYRHSLOC): Don't have two definitions, one for
the normal case and one for the error case.  Just use the
first one uniformly.  Problem reported by Frank Heckenbach.
(YYLLOC_DEFAULT): Use the conventions of yacc.c, so we can
use exactly the same macro in both places.
(yyerror_range): Now of type yyGLRStackItem, not YYLTYPE,
so that the normal-case YYRHSLOC works for the error case too.
All uses changed.
2004-12-12 09:25:45 +00:00
Paul Eggert
24e0cbd0e1 (YYRHSLOC): New macro, taken from glr.c.
(YYLLOC_DEFAULT): Use the same macro as glr.c.
2004-12-12 09:25:24 +00:00
Paul Eggert
766de5eb7c (Location Default Action): Don't claim that
we have an array of locations.  Use the same macro for both glr
and lalr parsers.  Mention YYRHSLOC.  Mention what happens when
the index is 0.
2004-12-12 09:24:56 +00:00
Paul Eggert
a4e1a53bf9 * HACKING: Update email addresses to send announcements to. 2004-12-11 08:06:29 +00:00
Paul Eggert
bf46a7c193 Update email addresses to send announcements to. 2004-12-11 08:06:10 +00:00
Paul Eggert
48814dcd46 * configure.ac (AC_INIT): Bump version to 1.875f. 2004-12-11 07:23:35 +00:00
Paul Eggert
1c1609b7d0 (AC_INIT): Bump version to 1.875f. 2004-12-11 07:23:21 +00:00
Paul Eggert
68b082af0c Update log file entry for latest checkin to tests/actions.at. 2004-12-11 07:08:34 +00:00
Paul Eggert
a14a26fa44 (_AT_CHECK_PRINTER_AND_DESTRUCTOR): New arg
specifying whether the test should be skipped.  Use it tp
specify that the [%defines %skeleton "lalr1.cc"] tests currently
fail on some hosts, and should be skipped.
2004-12-11 07:07:48 +00:00
Paul Eggert
5bdca67817 Update GNU m4 URL. 2004-12-11 06:28:24 +00:00
Paul Eggert
337116ba3d Version 1.875e. 2004-12-11 06:26:25 +00:00
Paul Eggert
db5c43f791 Include "complain.h", for "fatal". 2004-12-11 06:16:44 +00:00
Paul Eggert
7b21ee09da (relation_print, relation_digraph):
Relation sizes are of type relation_node, not size_t (this is
merely a doc fix, since the two types are equivalent).
(relation_transpose): Relation sizes are of type relation_node,
not int.
(top, infinity): Now of type relation_node, not int.
(traverse, relation_transpose): Use relation_node, not int.
2004-12-11 06:13:07 +00:00
Paul Eggert
88636fbd49 (relation_print, relation_digraph):
Relation sizes are of type relation_node, not size_t (this is
merely a doc fix, since the two types are equivalent).
(relation_transpose): Relation sizes are of type relation_node,
not int.
2004-12-11 06:12:41 +00:00
Paul Eggert
80a183578b (yyuserAction, yyrecoverSyntaxError): Mark args
with ATTRIBUTE_UNUSED if they're not used, to avoid GCC warning.
(yyparse): Remove unused local introduced in 2004-10-25 patch.
2004-12-11 06:07:11 +00:00
Paul Eggert
046ac74eef (_AT_CHECK_PRINTER_AND_DESTRUCTOR): New arg
specifying whether the test is expected to fail.  Use it tp
specify that the [%defines %skeleton "lalr1.cc"] tests currently
fail.
2004-12-11 05:38:19 +00:00
Paul Eggert
161a71f34c Correct URLs to email messages, so that they work with new GNU
organization.
2004-12-11 04:40:53 +00:00
Paul Eggert
267757362f Add Alexandre Duret-Lutz, Baron Schwartz, Frank Heckenbach, Guido
Trentalancia, Peter Fales, Troy A. Johnson, Vin Shelton.  Change Paul
Eggert's email address.
2004-12-11 04:40:20 +00:00
Paul Eggert
da2a7671e1 * src/system.h (CALLOC, MALLOC, REALLOC): Remove. All callers
changed to use xcalloc, xnmalloc, xnrealloc, respectively,
unless otherwise specified below.

* src/LR0.c (allocate_itemsets): Use xnmalloc, not xcalloc,
to allocate kernel_base, kernel_items, kernel_size, since
they needn't be initialized to 0.
(allocate_storgae): Likewise, for shiftset, redset, shift_symbol.
* src/closure.c (new_closure): Likewise, for itemset.
* src/derives.c (derives_compute): Likewise, for delts, derives, q.
* src/lalr.c (set_goto_map): Likewise, for temp_map.
(initialize_F): Likewise, for reads, edge, reads[i], includes[i].
(build_relations): Likewise for edge, states1, includes.
* src/nullable.c (nullable_compute): Likewise, for squeue, relts.
* src/reader.c (packgram): Likewise, for ritem, rules.
* src/reduce.c (nonterminals_reduce): Likewise for nontermmap.
* src/relation.c (relation_digraph): Likewise for VERTICES.
(relation_transpose): Likewise for new_R, end_R.
* src/symtab.c (symbols_token_translations_init): Likewise for
token_translations.
* src/tables.c (save_row): Likewise for froms, tos, conflict_tos.
(token_actions): Likewise for yydefact, actrow, conflrow,
conflict_list.
(save_column): Likewise for froms[symno], tos[symno].
(goto_actions): Likewise for state_count.
(pack_table): Likewise for base, pos, check.
(tables_generate): Likewise for width.

* src/LR0.c (set_states): Don't reuse kernel_size and kernel_base
for initial core.  Just have a separate core, so we needn't worry
about whether kernel_size and kernel_base are initialized.

* src/LR0.c (shift_symbol, redset, shiftset, kernel_base,
kernel_size, kernel_items): Remove unnecessary initialization.
* src/conflicts.c (conflicts): Likewise.
* src/derives.c (derives): Likewise.
* src/muscle_tablc (muscle_insert): Likewise.
* src/relation.c (relation_digraph): Likewise.
* src/tables.c (froms, tos, conflict_tos, tally, width, actrow, order,
conflrow, conflict_table, conflict_list, table, check):
Likewise.

* src/closure.c (new_closure): Arg is of type unsigned int, not int.
This is because all callers pass unsigned int.
* src/closure.h (new_closure): Likewise.

* src/lalr.c (initialize_F): Initialize reads[i] in all cases.
(build_relations): Initialize includes[i] in all cases.
* src/reader.c (packgram): Always initialize rules[ruleno].prec
and rules[ruleno].precsym.  Initialize members in order.
* src/relation.c (relation_transpose): Always initialize new_R[i]
and end_R[i].
* src/table.c (conflict_row): Initialize 0 at end of conflict_list.

* src/output.c (prepare_actions): Pass 0 instead of conflict_list[0];
conflict_list[0] was always 0, but now it isn't initialized.

* src/table.c (table_grow): When conflict_table grew, the grown
area wasn't cleared.  Fix this.
2004-12-10 07:50:44 +00:00
Paul Eggert
86a54ab102 (allocate_itemsets): Use xnmalloc, not xcalloc,
to allocate kernel_base, kernel_items, kernel_size, since
they needn't be initialized to 0.
(set_states): Don't reuse kernel_size and kernel_base
for initial core.  Just have a separate core, so we needn't worry
about whether kernel_size and kernel_base are initialized.
(shift_symbol, redset, shiftset, kernel_base,
kernel_size, kernel_items): Remove unnecessary initialization.
2004-12-10 07:48:43 +00:00
Paul Eggert
8175837596 (CALLOC, MALLOC, REALLOC): Remove. 2004-12-10 07:47:58 +00:00
Paul Eggert
67961b9ea0 Add strdup.m4. 2004-12-09 07:55:04 +00:00
Paul Eggert
44aabce335 Add strdup.c, strdup.h. 2004-12-09 07:54:47 +00:00
Paul Eggert
00baeeac7e goto-number minor cleanup. 2004-12-08 07:30:21 +00:00
Paul Eggert
78143b92af (save_column, default_goto):
Use goto_number, not int, for goto numbers.
2004-12-08 05:54:51 +00:00
Paul Eggert
60e3ecc734 (set_goto_map): Don't allow ngotos to equal
GOTO_NUMBER_MAXIMUM, since we occasionally compute
ngotos + 1 without checking for overflow.
(build_relations): Use END_NODE, not -1, to denote end of edges.
(set_goto_map, map_goto, initialize_F, add_loopback_edge,
build_relations): Use goto_number, not int, for goto numbers.
2004-12-08 05:54:20 +00:00
Paul Eggert
b03595a5c2 (GOTO_NUMBER_MAXIMUM): New macro. 2004-12-08 05:53:55 +00:00
Akim Demaille
be3d9d4219 2004-11-23 Akim Demaille <akim@epita.fr>
* data/lalr1.cc (YYSTYPE): Define it as is done for C, instead
	of #defining from yystype.
	Don't typedef yystype, C++ does not need it.
	This lets it possible to forward declare it as union.
2004-11-23 19:56:12 +00:00