* src/LR0.c (state_list_t, state_list_append): New.

(first_state, last_state): Now symbol_list_t.
(this_state): Remove.
(new_itemsets, append_states, save_reductions): Take a state_t as
argument.
(set_states, generate_states): Adjust.
(save_shifts): Remove, replaced by...
* src/state.h, src/state.c (state_shifts_set): New.
(shifts): Rename as...
(shifts_t): this.
Adjust all dependencies.
* src/state.h (state_t): Remove the `next' member.
This commit is contained in:
Akim Demaille
2002-06-30 17:30:29 +00:00
parent e5fb671032
commit 32e1e0a486
11 changed files with 137 additions and 101 deletions

View File

@@ -101,13 +101,11 @@ typedef short state_number_t;
| Shifts. |
`---------*/
typedef struct shifts
typedef struct shifts_s
{
short nshifts;
state_number_t shifts[1];
} shifts;
shifts *shifts_new PARAMS ((int n));
} shifts_t;
/* What is the symbol which is shifted by SHIFTS->shifts[Shift]? Can
@@ -175,11 +173,9 @@ reductions *reductions_new PARAMS ((int n));
typedef struct state_s
{
struct state_s *next;
state_number_t number;
symbol_number_t accessing_symbol;
shifts *shifts;
shifts_t *shifts;
reductions *reductions;
errs *errs;
@@ -205,13 +201,15 @@ extern state_number_t nstates;
extern state_t *final_state;
/* Create a new state with ACCESSING_SYMBOL for those items. */
state_t *state_new PARAMS ((symbol_number_t accessing_symbol,
size_t core_size, item_number_t *core));
/* Set the shifts of STATE. */
void state_shifts_set PARAMS ((state_t *state,
int nshifts, state_number_t *shifts));
/* Print on OUT all the lookaheads such that this STATE wants to
reduce this RULE. */
void state_rule_lookaheads_print PARAMS ((state_t *state, rule_t *rule,
FILE *out));