-void
-dump_grammar ()
-{
- int i;
- rule r;
-
- fprintf(foutput,
- "ntokens = %d, nvars = %d, nsyms = %d, nrules = %d, nitems = %d\n\n",
- ntokens, nvars, nsyms, nrules, nitems);
- fprintf(foutput, "Variables\n---------\n\n");
- fprintf(foutput, "Value Sprec Sassoc Tag\n");
- for (i = ntokens; i < nsyms; i++)
- fprintf(foutput, "%5d %5d %5d %s\n",
- i, sprec[i], sassoc[i], tags[i]);
- fprintf(foutput, "\n\n");
- fprintf(foutput, "Rules\n-----\n\n");
- for (i = 1; i <= nrules; i++)
- {
- fprintf(foutput, "%-5d(%5d%5d)%5d : (@%-5d)",
- i, rprec[i], rassoc[i], rlhs[i], rrhs[i]);
- for (r = &ritem[rrhs[i]]; *r > 0; r++)
- fprintf(foutput, "%5d", *r);
- fprintf(foutput, " [%d]\n", -(*r));
- }
- fprintf(foutput, "\n\n");
- fprintf(foutput, "Rules interpreted\n-----------------\n\n");
- for (i = 1; i <= nrules; i++)
- {
- fprintf(foutput, "%-5d %s :", i, tags[rlhs[i]]);
- for (r = &ritem[rrhs[i]]; *r > 0; r++)
- fprintf(foutput, " %s", tags[*r]);
- fprintf(foutput, "\n");
- }
- fprintf(foutput, "\n\n");
-}