+
+/*---------.
+| states. |
+`---------*/
+
+struct state
+{
+ state_number number;
+ symbol_number accessing_symbol;
+ transitions *transitions;
+ reductions *reductions;
+ errs *errs;
+
+ /* Nonzero if no lookahead is needed to decide what to do in state S. */
+ char consistent;
+
+ /* If some conflicts were solved thanks to precedence/associativity,
+ a human readable description of the resolution. */
+ const char *solved_conflicts;
+
+ /* Its items. Must be last, since ITEMS can be arbitrarily large.
+ */
+ unsigned short nitems;
+ item_number items[1];
+};
+
+extern state_number nstates;
+extern state *final_state;
+
+/* Create a new state with ACCESSING_SYMBOL for those items. */
+state *state_new (symbol_number accessing_symbol,
+ size_t core_size, item_number *core);
+
+/* Set the transitions of STATE. */
+void state_transitions_set (state *s, int num, state **trans);
+
+/* Set the reductions of STATE. */
+void state_reductions_set (state *s, int num, rule **reds);
+
+int state_reduction_find (state *s, rule *r);
+
+/* Set the errs of STATE. */
+void state_errs_set (state *s, int num, symbol **errors);
+
+/* Print on OUT all the lookaheads such that this STATE wants to
+ reduce R. */
+void state_rule_lookaheads_print (state *s, rule *r, FILE *out);
+
+/* Create/destroy the states hash table. */
+void state_hash_new (void);
+void state_hash_free (void);
+
+/* Find the state associated to the CORE, and return it. If it does
+ not exist yet, return NULL. */
+state *state_hash_lookup (size_t core_size, item_number *core);
+
+/* Insert STATE in the state hash table. */
+void state_hash_insert (state *s);
+
+/* All the states, indexed by the state number. */
+extern state **states;
+
+/* Free all the states. */
+void states_free (void);