19 |
Boston, MA 02111-1307, USA. */ |
Boston, MA 02111-1307, USA. */ |
20 |
|
|
21 |
|
|
|
/* set_derives finds, for each variable (nonterminal), which rules can |
|
|
derive it. It sets up the value of derives so that derives[i - |
|
|
ntokens] points to a vector of rule numbers, terminated with -1. |
|
|
*/ |
|
|
|
|
22 |
#include "system.h" |
#include "system.h" |
23 |
#include "getargs.h" |
#include "getargs.h" |
24 |
#include "types.h" |
#include "types.h" |
26 |
#include "gram.h" |
#include "gram.h" |
27 |
#include "derives.h" |
#include "derives.h" |
28 |
|
|
29 |
short **derives; |
short **derives = NULL; |
|
|
|
30 |
|
|
31 |
static void |
static void |
32 |
print_derives (void) |
print_derives (void) |
45 |
fprintf (stderr, "\t\t%d:", *sp); |
fprintf (stderr, "\t\t%d:", *sp); |
46 |
for (rhsp = ritem + rule_table[*sp].rhs; *rhsp > 0; ++rhsp) |
for (rhsp = ritem + rule_table[*sp].rhs; *rhsp > 0; ++rhsp) |
47 |
fprintf (stderr, " %s", tags[*rhsp]); |
fprintf (stderr, " %s", tags[*rhsp]); |
48 |
fputc ('\n', stderr); |
fprintf (stderr, " (rule %d)\n", -*rhsp); |
49 |
} |
} |
50 |
} |
} |
51 |
|
|