+/*-------------.
+| Free STATE. |
+`-------------*/
+
+static void
+state_free (state_t *state)
+{
+ free (state->transitions);
+ free (state->reductions);
+ free (state->errs);
+ free (state);
+}
+
+
+/*-------------------------------.
+| Set the transitions of STATE. |
+`-------------------------------*/
+
+void
+state_transitions_set (state_t *state, int num, state_t **transitions)
+{
+ assert (!state->transitions);
+ state->transitions = transitions_new (num, transitions);
+}
+
+
+/*------------------------------.
+| Set the reductions of STATE. |
+`------------------------------*/
+
+void
+state_reductions_set (state_t *state, int num, rule_t **reductions)
+{
+ assert (!state->reductions);
+ state->reductions = reductions_new (num, reductions);
+}
+
+
+int
+state_reduction_find (state_t *state, rule_t *rule)
+{
+ int i;
+ reductions_t *reds = state->reductions;
+ for (i = 0; i < reds->num; ++i)
+ if (reds->rules[i] == rule)
+ return i;
+ return -1;
+}
+
+
+/*------------------------.
+| Set the errs of STATE. |
+`------------------------*/
+
+void
+state_errs_set (state_t *state, int num, symbol_t **tokens)
+{
+ assert (!state->errs);
+ state->errs = errs_new (num, tokens);
+}
+
+
+