113 for (i = 3; i <
nrules; i++)
132 for (i = 3; i <
nrules; i++)
208 register int shiftcount, reducecount;
209 register int max, min;
210 register short *actionrow, *r, *s;
218 for (j = 0; j < 2*
ntokens; ++j)
240 tally[i] = shiftcount;
241 tally[nstates+i] = reducecount;
243 width[nstates+i] = 0;
247 tos[i] = s =
NEW2(shiftcount,
short);
262 width[i] = max - min + 1;
266 froms[nstates+i] = r =
NEW2(reducecount,
short);
267 tos[nstates+i] = s =
NEW2(reducecount,
short);
272 if (actionrow[ntokens+j])
279 *s++ = actionrow[ntokens+j] - 2;
282 width[nstates+i] = max - min + 1;
291 register int i, j, k;
328 register int default_state;
334 if (m == n)
return (0);
339 for (i = m; i < n; i++)
353 return (default_state);
375 for (i = m; i < n; i++)
380 if (count == 0)
return;
384 froms[symno] = sp1 = sp =
NEW2(count,
short);
385 tos[symno] = sp2 =
NEW2(count,
short);
387 for (i = m; i < n; i++)
396 tally[symno] = count;
397 width[symno] = sp1[-1] - sp[0] + 1;
516 for (prev = vector - 1; prev >= 0; prev--)
523 for (k = 0; match && k < t; k++)
542 register int i, j, k, l;
546 register short *from;
558 for (k = 1; k < t; ++k)
566 for (k = 0; ok && k < t; k++)
572 fatal(
"maximum table size exceeded");
575 do { newmax += 200; }
while (newmax <= loc);
588 if (
check[loc] != -1)
591 for (k = 0; ok && k < vector; k++)
598 for (k = 0; k < t; k++)
602 check[loc] = from[k];
642 for (i = nstates + 1; i < 2*
nstates; i++)
661 for (i = 2*nstates + 1; i <
nvectors - 1; i++)
693 for (i = 1; i <=
high; i++)
723 for (i = 1; i <=
high; i++)
755 if (!isalpha(c) && c !=
'_' && c !=
'$')
757 while ((c = *++s) !=
'"')
759 if (!isalnum(c) && c !=
'_' && c !=
'$')
765 if (!isalpha(c) && c !=
'_' && c !=
'$')
769 if (!isalnum(c) && c !=
'_' && c !=
'$')
791 while ((c = *++s) !=
'"')
822 fprintf(
defines_file,
" YYSTYPE;\nextern YYSTYPE %slval;\n",
831 register FILE *in, *out;
838 if ((c = getc(in)) == EOF)
844 while ((c = getc(in)) != EOF)
857 register int i, j, k, max;
863 fprintf(
code_file,
"#ifndef YYDEBUG\n#define YYDEBUG %d\n#endif\n",
866 fprintf(
output_file,
"#ifndef YYDEBUG\n#define YYDEBUG %d\n#endif\n",
874 fprintf(
code_file,
"#define YYMAXTOKEN %d\n", max);
876 symnam = (
char **)
MALLOC((max+1)*
sizeof(
char *));
881 for (i = 0; i < max; ++i)
883 for (i = ntokens - 1; i >= 2; --i)
885 symnam[0] =
"end-of-file";
890 for (i = 0; i <= max; ++i)
931 else if (s[0] ==
'\'')
1015 for (i = 2; i <
nrules; ++i)
1039 else if (s[0] ==
'\'')
1043 else if (s[1] ==
'\\')
1050 while (*++s !=
'\'')
1074 fprintf(
code_file,
"#ifndef YYSTYPE\ntypedef int YYSTYPE;\n#endif\n");
1081 register int c, last;
1082 register FILE *in, *out;
1093 if ((c = getc(in)) == EOF)
1112 do { putc(c, out); }
while ((c = *++
cptr) !=
'\n');
1118 while ((c = getc(in)) != EOF)
1138 register int c, last;
output_semantic_actions()
open_error(char *filename)
short * rlhs
List of left-hand sides of all rules.
int ntokens
The number of tokens (terminals) in the grammar.
save_column(int symbol, int default_state)
int default_goto(int symbol)
int nrules
The number of rules in the grammar.
reductions * first_reduction
int nvars
The number of variables (non-terminals) in the grammar.
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)
static short * state_count
int start_symbol
Index of the starting symbol of the grammar.
int matching_vector(int vector)
int is_C_identifier(char *name)
char ** symbol_name
Array of symbol names.
reductions ** reduction_table
int pack_vector(int vector)