54 register unsigned *row;
68 for (rule = *sp; rule > 0; rule = *++sp)
102 register unsigned *rrow;
103 register unsigned *vrow;
106 register unsigned cword;
133 if (cword & (1 << k))
136 while ((rule = *rp++) >= 0)
148 print_first_derives();
160 register unsigned word;
163 register unsigned *dsp;
164 register unsigned *rsp;
165 register int rulesetsize;
175 for (rsp =
ruleset; rsp < rsend; rsp++)
179 for (csp = nucleus; csp < csend; ++csp)
181 symbol =
ritem[*csp];
194 for (rsp =
ruleset; rsp < rsend; ++rsp)
203 itemno =
rrhs[ruleno+i];
204 while (csp < csend && *csp < itemno)
207 while (csp < csend && *csp == itemno)
240 printf(
"\n\nn = %d\n\n", n);
242 printf(
" %d\n", *isp);
249 register unsigned *rowp;
250 register unsigned word;
253 printf(
"\n\nEpsilon Free Firsts\n");
262 for (j = 0; j <
nvars; k++, j++)
277 print_first_derives()
281 register unsigned *rp;
282 register unsigned cword;
285 printf(
"\n\n\nFirst Derives\n");
292 for (j = 0; j <=
nrules; k++, j++)
300 if (cword & (1 << k))
unsigned * ruleset
Bitset of closure items for the current state.
closure(short *nucleus, int n)
int ntokens
The number of tokens (terminals) in the grammar.
static unsigned * first_derives
Matrix of closure productions.
set_EFF()
Populates EFF, the matrix of Epsilon-Free Firsts.
int nrules
The number of rules in the grammar.
set_first_derives()
Populates first_derives, the matrix of closure productions.
int nvars
The number of variables (non-terminals) in the grammar.
reflexive_transitive_closure(unsigned *R, int n)
int nsyms
The number of symbols (terminals + non-terminals) in the grammar.
short * rrhs
List of right-hand sides of all rules.
short * ritem
Representation of all productions (and items)
short ** derives
List of rules that derive each non-terminal.
int start_symbol
Index of the starting symbol of the grammar.
char ** symbol_name
Array of symbol names.
static unsigned * EFF
Matrix of Epsilon-Free Firsts.