* src/conflicts.c (conflicts_total_count): `i' is unsigned, to
pacify GCC.
* src/output.c (save_row): Initialize all the variables to pacify GCC.
(merger_output): static.
+2002-06-28 Akim Demaille <akim@epita.fr>
+
+ * src/reader.h: s/grammer_current_rule_merge_set/grammar_.../.
+ * src/conflicts.c (conflicts_total_count): `i' is unsigned, to
+ pacify GCC.
+ * src/output.c (save_row): Initialize all the variables to pacify GCC.
+ (merger_output): static.
+
2002-06-27 Paul Hilfinger <Hilfinger@CS.Berkeley.EDU>
Accumulated changelog for new GLR parsing features.
2002-06-27 Paul Hilfinger <Hilfinger@CS.Berkeley.EDU>
Accumulated changelog for new GLR parsing features.
- * src/conflicts.c (count_total_conflicts): Change name to
+ * src/conflicts.c (count_total_conflicts): Change name to
conflicts_total_count.
* src/conflicts.h: Ditto.
* src/output.c (token_actions): Use the new name.
conflicts_total_count.
* src/conflicts.h: Ditto.
* src/output.c (token_actions): Use the new name.
confl => conflict_list for better readability.
* data/glr.c: Use the new names.
* NEWS: Add self to GLR announcement.
confl => conflict_list for better readability.
* data/glr.c: Use the new names.
* NEWS: Add self to GLR announcement.
* src/reader.c (free_merger_functions): Cleanup: XFREE->free.
* doc/bison.texinfo (GLR Parsers): Make corrections suggested by
* src/reader.c (free_merger_functions): Cleanup: XFREE->free.
* doc/bison.texinfo (GLR Parsers): Make corrections suggested by
* data/bison.glr: Change name to glr.c
* data/glr.c: Renamed from bison.glr.
* data/Makefile.am: Add glr.c
* data/bison.glr: Change name to glr.c
* data/glr.c: Renamed from bison.glr.
* data/Makefile.am: Add glr.c
* src/symlist.h: Add dprec and merger fields to symbol_list_s.
* src/symlist.c (symbol_list_new): Initialize dprec and merger fields.
* src/symlist.h: Add dprec and merger fields to symbol_list_s.
* src/symlist.c (symbol_list_new): Initialize dprec and merger fields.
Originally 2002-06-16 Paul Hilfinger <Hilfinger@CS.Berkeley.EDU>
* data/bison.glr: Be sure to restore the
Originally 2002-06-16 Paul Hilfinger <Hilfinger@CS.Berkeley.EDU>
* data/bison.glr: Be sure to restore the
yytokenp argument; now part of stack.
(yychar): Define to behave as documented.
(yyclearin): Ditto.
yytokenp argument; now part of stack.
(yychar): Define to behave as documented.
(yyclearin): Ditto.
Originally 2002-05-14 Paul Hilfinger <Hilfinger@CS.Berkeley.EDU>
* src/reader.h: Add declaration for free_merger_functions.
Originally 2002-05-14 Paul Hilfinger <Hilfinger@CS.Berkeley.EDU>
* src/reader.h: Add declaration for free_merger_functions.
* src/output.c (conflict_tos, conflrow, conflict_table, conflict_list,
conflict_list_cnt, conflict_list_free): New variables.
(table_grow): Also grow conflict_table.
* src/output.c (conflict_tos, conflrow, conflict_table, conflict_list,
conflict_list_cnt, conflict_list_free): New variables.
(table_grow): Also grow conflict_table.
- (prepare_rules): Output dprec and merger tables.
+ (prepare_rules): Output dprec and merger tables.
(conflict_row): New function.
(conflict_row): New function.
- (action_row): Output conflict lists for GLR parser. Don't use
+ (action_row): Output conflict lists for GLR parser. Don't use
default reduction in conflicted states for GLR parser so that there
are spaces for the conflict lists.
(save_row): Also save conflict information.
default reduction in conflicted states for GLR parser so that there
are spaces for the conflict lists.
(save_row): Also save conflict information.
* src/conflicts.c (count_rr_conflicts): Augment to optionally count
all pairs of conflicting reductions, rather than just all tokens
causing conflicts. Needed to size conflict tables.
* src/conflicts.c (count_rr_conflicts): Augment to optionally count
all pairs of conflicting reductions, rather than just all tokens
causing conflicts. Needed to size conflict tables.
- (conflicts_output): Modify call to count_rr_conflicts for new
+ (conflicts_output): Modify call to count_rr_conflicts for new
interface.
(conflicts_print): Ditto.
(count_total_conflicts): New function.
interface.
(conflicts_print): Ditto.
(count_total_conflicts): New function.
* tests/testsuite.at: Include cxx-gram.at.
* tests/Makefile.am: Add cxx-gram.at.
* tests/testsuite.at: Include cxx-gram.at.
* tests/Makefile.am: Add cxx-gram.at.
* src/parse-gram.y:
* src/scan-gram.l: Add %dprec, %glr-parser, %merge.
* src/parse-gram.y: Grammar for %dprec, %merge, %glr-parser.
* src/parse-gram.y:
* src/scan-gram.l: Add %dprec, %glr-parser, %merge.
* src/parse-gram.y: Grammar for %dprec, %merge, %glr-parser.
2002-06-27 Akim Demaille <akim@epita.fr>
* src/options.h, src/options.c: Remove.
2002-06-27 Akim Demaille <akim@epita.fr>
* src/options.h, src/options.c: Remove.
int
conflicts_total_count (void)
{
int
conflicts_total_count (void)
{
int count;
/* Conflicts by state. */
int count;
/* Conflicts by state. */
/*------------------------------------------.
| Reporting the total number of conflicts. |
/*------------------------------------------.
| Reporting the total number of conflicts. |
if (! glr_parser)
return;
if (! glr_parser)
return;
- for (j = 0; j < ntokens; j += 1)
- if (conflrow[j])
+ for (j = 0; j < ntokens; j += 1)
+ if (conflrow[j])
{
conflrow[j] = conflict_list_cnt;
{
conflrow[j] = conflict_list_cnt;
for (i = 0; i < state->nlookaheads; i += 1)
if (bitset_test (state->lookaheads[i], j)
&& actrow[j] != -state->lookaheads_rule[i]->number)
for (i = 0; i < state->nlookaheads; i += 1)
if (bitset_test (state->lookaheads[i], j)
&& actrow[j] != -state->lookaheads_rule[i]->number)
assert (conflict_list_free > 0);
assert (conflict_list_free > 0);
- conflict_list[conflict_list_cnt]
+ conflict_list[conflict_list_cnt]
= state->lookaheads_rule[i]->number;
conflict_list_cnt += 1;
conflict_list_free -= 1;
}
= state->lookaheads_rule[i]->number;
conflict_list_cnt += 1;
conflict_list_free -= 1;
}
/* Leave a 0 at the end */
assert (conflict_list_free > 0);
conflict_list_cnt += 1;
/* Leave a 0 at the end */
assert (conflict_list_free > 0);
conflict_list_cnt += 1;
/* GLR parsers need space for conflict lists, so we can't
default conflicted entries. For non-conflicted entries
/* GLR parsers need space for conflict lists, so we can't
default conflicted entries. For non-conflicted entries
- or as long as we are not building a GLR parser,
+ or as long as we are not building a GLR parser,
actions that match the default are replaced with zero,
which means "use the default". */
actions that match the default are replaced with zero,
which means "use the default". */
- short *sp;
- short *sp1;
- short *sp2;
- unsigned int *sp3;
+ short *sp = NULL;
+ short *sp1 = NULL;
+ short *sp2 = NULL;
+ unsigned int *sp3 = NULL;
count = 0;
for (i = 0; i < ntokens; i++)
count = 0;
for (i = 0; i < ntokens; i++)
froms[state] = sp1 = sp = XCALLOC (short, count);
tos[state] = sp2 = XCALLOC (short, count);
if (glr_parser)
froms[state] = sp1 = sp = XCALLOC (short, count);
tos[state] = sp2 = XCALLOC (short, count);
if (glr_parser)
- conflict_tos[state] = sp3 = XCALLOC (unsigned int, count);
- else
+ conflict_tos[state] = sp3 = XCALLOC (unsigned int, count);
+ else
conflict_tos[state] = NULL;
for (i = 0; i < ntokens; i++)
conflict_tos[state] = NULL;
for (i = 0; i < ntokens; i++)
conflict_list = XCALLOC (unsigned int, 1 + 2 * nconflict);
conflict_list_free = 2 * nconflict;
conflict_list_cnt = 1;
conflict_list = XCALLOC (unsigned int, 1 + 2 * nconflict);
conflict_list_free = 2 * nconflict;
conflict_list_cnt = 1;
conflict_list_free = conflict_list_cnt = 0;
for (i = 0; i < nstates; ++i)
conflict_list_free = conflict_list_cnt = 0;
for (i = 0; i < nstates; ++i)
merger_list* p;
fputs ("m4_define([b4_mergers], \n[[", out);
merger_list* p;
fputs ("m4_define([b4_mergers], \n[[", out);
- for (n = 1, p = merge_functions; p != NULL; n += 1, p = p->next)
+ for (n = 1, p = merge_functions; p != NULL; n += 1, p = p->next)
- if (p->type[0] == '\0')
+ if (p->type[0] == '\0')
fprintf (out, " case %d: yyval = %s (*yy0, *yy1); break;\n",
n, p->name);
else
fprintf (out, " case %d: yyval = %s (*yy0, *yy1); break;\n",
n, p->name);
else
if (! glr_parser)
return;
if (! glr_parser)
return;
- muscle_insert_unsigned_int_table ("conflict_list_heads", conflict_table,
+ muscle_insert_unsigned_int_table ("conflict_list_heads", conflict_table,
conflict_table[0], 1, high+1);
conflict_table[0], 1, high+1);
- muscle_insert_unsigned_int_table ("conflicting_rules", conflict_list,
+ muscle_insert_unsigned_int_table ("conflicting_rules", conflict_list,
conflict_list[0], 1, conflict_list_cnt);
XFREE (conflict_table);
conflict_list[0], 1, conflict_list_cnt);
XFREE (conflict_table);
struct merger_list* next;
const char* name;
const char* type;
struct merger_list* next;
const char* name;
const char* type;
merger_list;
typedef struct gram_control_s
merger_list;
typedef struct gram_control_s
location_t l));
void grammar_current_rule_dprec_set PARAMS ((int dprec,
location_t l));
location_t l));
void grammar_current_rule_dprec_set PARAMS ((int dprec,
location_t l));
-void grammer_current_rule_merge_set PARAMS ((const char* name,
+void grammar_current_rule_merge_set PARAMS ((const char* name,
location_t l));
void grammar_current_rule_symbol_append PARAMS ((symbol_t *symbol,
location_t l));
void grammar_current_rule_symbol_append PARAMS ((symbol_t *symbol,