add LR(0) output

This should not be used to generate parsers.  My point is actually to
facilitate debugging (when tweaking the generation of the LR(0)
automaton for instance, not carying -yet- about lookaheads).

* src/reader.c (prepare_percent_define_front_end_variables): Add lr(0).
* src/conflicts.c (set_conflicts): Be robust to reds not having
lookaheads at all.
* src/ielr.c (LrType, lr_type_get): Adjust.
(ielr): Implement support for LR(0).
* src/lalr.c (lalr_free): Don't free LA when it's not computed.
This commit is contained in:
Akim Demaille
2019-01-27 18:29:17 +01:00
parent 0d44f83fcc
commit e346210c03
3 changed files with 68 additions and 42 deletions

View File

@@ -754,11 +754,12 @@ prepare_percent_define_front_end_variables (void)
/* Check %define front-end variables. */
{
static char const * const values[] = {
"lr.type", "lalr", "ielr", "canonical-lr", NULL,
"lr.default-reduction", "most", "consistent", "accepting", NULL,
NULL
};
static char const * const values[] =
{
"lr.type", "lr(0)", "lalr", "ielr", "canonical-lr", NULL,
"lr.default-reduction", "most", "consistent", "accepting", NULL,
NULL
};
muscle_percent_define_check_values (values);
}
}