-#include "types.h"
-#include "state.h"
-#include "alloc.h"
-#include "gram.h"
-#include "complain.h"
-
-extern short **derives;
-extern char *nullable;
-
-
-int tokensetsize;
-short *lookaheads;
-short *LAruleno;
-unsigned *LA;
-short *accessing_symbol;
-char *consistent;
-core **state_table;
-shifts **shift_table;
-reductions **reduction_table;
-short *goto_map;
-short *from_state;
-short *to_state;
-
-extern void lalr PARAMS((void));
-
-static short **transpose PARAMS((short **, int));
-static void set_state_table PARAMS((void));
-static void set_accessing_symbol PARAMS((void));
-static void set_shift_table PARAMS((void));
-static void set_reduction_table PARAMS((void));
-static void set_maxrhs PARAMS((void));
-static void initialize_LA PARAMS((void));
-static void set_goto_map PARAMS((void));
-static int map_goto PARAMS((int, int));
-static void initialize_F PARAMS((void));
-static void build_relations PARAMS((void));
-static void add_lookback_edge PARAMS((int, int, int));
-static void compute_FOLLOWS PARAMS((void));
-static void compute_lookaheads PARAMS((void));
-static void digraph PARAMS((short **));
-static void traverse PARAMS((register int));
-
-extern void berror PARAMS((const char *));
-
-static int infinity;
-static int maxrhs;
-static int ngotos;
-static unsigned *F;
-static short **includes;
-static shorts **lookback;
-static short **R;
-static short *INDEX;
-static short *VERTICES;
-static int top;
-
-
-void
-lalr (void)
-{
- tokensetsize = WORDSIZE(ntokens);
-
- set_state_table();
- set_accessing_symbol();
- set_shift_table();
- set_reduction_table();
- set_maxrhs();
- initialize_LA();
- set_goto_map();
- initialize_F();
- build_relations();
- compute_FOLLOWS();
- compute_lookaheads();
-}
-
-
-static void
-set_state_table (void)
-{
- register core *sp;
-
- state_table = NEW2(nstates, core *);
-
- for (sp = first_state; sp; sp = sp->next)
- state_table[sp->number] = sp;
-}
-
-
-static void
-set_accessing_symbol (void)
-{
- register core *sp;