26 static action *parse_actions(
int stateno);
27 static action *get_shifts(
int stateno);
28 static action *add_reductions(
int stateno,
action *actions);
29 static action *add_reduce(
action *actions,
int ruleno,
int symbol);
30 static void find_final_state(
void);
31 static void unused_rules(
void);
32 static void remove_conflicts(
void);
33 static void total_conflicts(
void);
34 static void defreds(
void);
43 parser[i] = parse_actions(i);
54 parse_actions(
int stateno)
58 actions = get_shifts(stateno);
59 actions = add_reductions(stateno, actions);
65 get_shifts(
int stateno)
78 for (i = sp->
nshifts - 1; i >= 0; i--)
99 add_reductions(
int stateno,
action *actions)
108 for (i = m; i < n; i++)
112 for (j =
ntokens - 1; j >= 0; j--)
115 actions = add_reduce(actions, ruleno, j);
123 add_reduce(
action *actions,
int ruleno,
int symbol)
128 for (next = actions; next && next->
symbol < symbol; next = next->
next)
137 while (next && next->
symbol == symbol &&
162 find_final_state(
void)
171 for (i = p->
nshifts - 1; i >= 0; --i)
193 for (p = parser[i]; p; p = p->
next)
215 remove_conflicts(
void)
230 for (p = parser[i]; p; p = p->
next)
291 total_conflicts(
void)
295 fprintf(
stderr,
"1 shift/reduce conflict");
303 fprintf(
stderr,
"1 reduce/reduce conflict");
312 sole_reduction(
int stateno)
319 for (p = parser[stateno]; p; p = p->
next)
325 if (ruleno > 0 && p->
number != ruleno)
346 defred[i] = sole_reduction(i);
350 free_action_row(
action *p)
368 free_action_row(parser[i]);
void no_space(void) NORETURN