]>
git.saurik.com Git - bison.git/blob - src/output.c
1 /* Output the generated parsing program for bison,
2 Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002
3 Free Software Foundation, Inc.
5 This file is part of Bison, the GNU Compiler Compiler.
7 Bison is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
12 Bison is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with Bison; see the file COPYING. If not, write to the Free
19 Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
23 /* The parser tables consist of these tables. Marked ones needed only
24 for the semantic parser. Double marked are output only if switches
27 YYTRANSLATE = vector mapping yylex's token numbers into bison's
30 ++ YYTNAME = vector of string-names indexed by bison token number.
32 ++ YYTOKNUM = vector of yylex token numbers corresponding to
35 YYRLINE = vector of line-numbers of all rules. For yydebug
38 YYRHS = vector of items of all rules. This is exactly what RITEMS
39 contains. For yydebug and for semantic parser.
41 YYPRHS[R] = index in YYRHS of first item for rule R.
43 YYR1[R] = symbol number of symbol that rule R derives.
45 YYR2[R] = number of symbols composing right hand side of rule R.
47 + YYSTOS[S] = the symbol number of the symbol that leads to state
50 YYDEFACT[S] = default rule to reduce with in state s, when YYTABLE
51 doesn't specify something else to do. Zero means the default is an
54 YYDEFGOTO[I] = default state to go to after a reduction of a rule
55 that generates variable NTOKENS + I, except when YYTABLE specifies
58 YYPACT[S] = index in YYTABLE of the portion describing state S.
59 The lookahead token's type is used to index that portion to find
62 If the value in YYTABLE is positive, we shift the token and go to
65 If the value is negative, it is minus a rule number to reduce by.
67 If the value is zero, the default action from YYDEFACT[S] is used.
69 YYPGOTO[I] = the index in YYTABLE of the portion describing what to
70 do after reducing a rule that derives variable I + NTOKENS. This
71 portion is indexed by the parser state number, S, as of before the
72 text for this nonterminal was read. The value from YYTABLE is the
73 state to go to if the corresponding value in YYCHECK is S.
75 YYTABLE = a vector filled with portions for different uses, found
76 via YYPACT and YYPGOTO.
78 YYCHECK = a vector indexed in parallel with YYTABLE. It indicates,
79 in a roundabout way, the bounds of the portion you are trying to
82 Suppose that the portion of yytable starts at index P and the index
83 to be examined within the portion is I. Then if YYCHECK[P+I] != I,
84 I is outside the bounds of what is actually allocated, and the
85 default (from YYDEFACT or YYDEFGOTO) should be used. Otherwise,
86 YYTABLE[P+I] should be used.
88 YYFINAL = the state number of the termination state. YYFLAG = most
89 negative short int. Used to flag ?? */
104 #include "conflicts.h"
105 #include "muscle_tab.h"
107 /* From lib/readpipe.h. */
108 FILE *readpipe
PARAMS ((const char *, ...));
110 /* From src/scan-skel.l. */
111 int skel_lex
PARAMS ((void));
112 extern FILE *skel_in
;
116 static short **froms
= NULL
;
117 static short **tos
= NULL
;
118 static short *tally
= NULL
;
119 static short *width
= NULL
;
120 static short *actrow
= NULL
;
121 static short *state_count
= NULL
;
122 static short *order
= NULL
;
123 static short *base
= NULL
;
124 static short *pos
= NULL
;
125 static short *table
= NULL
;
126 static short *check
= NULL
;
130 struct obstack muscle_obstack
;
131 static struct obstack format_obstack
;
133 int error_verbose
= 0;
135 /* Returns the number of lines of S. */
137 get_lines_number (const char *s
)
142 for (i
= 0; s
[i
]; ++i
)
150 /*----------------------------------------------------------------.
151 | Format the FIRST and then TABLE_DATA[BEGIN..END[ into OOUT, and |
152 | return the number of bits needed for its longuest value. |
153 `----------------------------------------------------------------*/
155 static inline long int
156 output_short_table (struct obstack
*oout
,
162 long int max
= first
;
166 obstack_fgrow1 (oout
, "%6d", first
);
167 for (i
= begin
; i
< end
; ++i
)
169 obstack_1grow (oout
, ',');
172 obstack_sgrow (oout
, "\n ");
177 obstack_fgrow1 (oout
, "%6d", table_data
[i
]);
178 if (table_data
[i
] > max
)
181 obstack_1grow (oout
, 0);
187 /*--------------------.
188 | Similar, for ints. |
189 `--------------------*/
191 static inline long int
192 output_int_table (struct obstack
*oout
,
198 long int max
= first
;
202 obstack_fgrow1 (oout
, "%6d", first
);
203 for (i
= begin
; i
< end
; ++i
)
205 obstack_1grow (oout
, ',');
208 obstack_sgrow (oout
, "\n ");
213 obstack_fgrow1 (oout
, "%6d", table_data
[i
]);
214 if (table_data
[i
] > max
)
217 obstack_1grow (oout
, 0);
223 /*-----------------------------------------------------------------.
224 | Prepare the muscles related to the tokens: translate, tname, and |
226 `-----------------------------------------------------------------*/
229 prepare_tokens (void)
231 long int max
= output_short_table (&format_obstack
, token_translations
,
232 0, 1, max_user_token_number
+ 1);
233 muscle_insert ("translate", obstack_finish (&format_obstack
));
234 MUSCLE_INSERT_LONG_INT ("token_number_max", max
);
235 XFREE (token_translations
);
240 for (i
= 0; i
< nsyms
; i
++)
242 /* Be sure not to use twice the same quotearg slot. */
244 quotearg_n_style (1, c_quoting_style
,
245 quotearg_style (escape_quoting_style
,
247 /* Width of the next token, including the two quotes, the coma
249 int strsize
= strlen (cp
) + 2;
251 if (j
+ strsize
> 75)
253 obstack_sgrow (&format_obstack
, "\n ");
257 obstack_sgrow (&format_obstack
, cp
);
258 obstack_sgrow (&format_obstack
, ", ");
261 /* Add a NULL entry to list of tokens (well, 0, as NULL might not be
263 obstack_sgrow (&format_obstack
, "0");
265 /* Finish table and store. */
266 obstack_1grow (&format_obstack
, 0);
267 muscle_insert ("tname", obstack_finish (&format_obstack
));
270 /* Output YYTOKNUM. */
273 short *values
= XCALLOC (short, ntokens
+ 1);
274 for (i
= 0; i
< ntokens
+ 1; ++i
)
275 values
[i
] = symbols
[i
]->user_token_number
;
276 output_short_table (&format_obstack
, values
,
278 muscle_insert ("toknum", obstack_finish (&format_obstack
));
284 /*-------------------------------------------------------------.
285 | Prepare the muscles related to the rules: rhs, prhs, r1, r2, |
287 `-------------------------------------------------------------*/
296 item_number_t
*rhs
= XMALLOC (item_number_t
, nritems
);
297 short *prhs
= XMALLOC (short, nrules
+ 1);
298 short *r1
= XMALLOC (short, nrules
+ 1);
299 short *r2
= XMALLOC (short, nrules
+ 1);
300 short *rline
= XMALLOC (short, nrules
+ 1);
302 for (r
= 1; r
< nrules
+ 1; ++r
)
304 /* Index of rule R in RHS. */
306 /* RHS of the rule R. */
307 for (rhsp
= rules
[r
].rhs
; *rhsp
>= 0; ++rhsp
)
309 /* LHS of the rule R. */
310 r1
[r
] = rules
[r
].lhs
->number
;
311 /* Length of rule R's RHS. */
313 /* Separator in RHS. */
315 /* Line where rule was defined. */
316 rline
[r
] = rules
[r
].line
;
318 assert (i
== nritems
);
320 max
= output_int_table (&format_obstack
, rhs
, ritem
[0], 1, nritems
);
321 muscle_insert ("rhs", obstack_finish (&format_obstack
));
322 MUSCLE_INSERT_LONG_INT ("rhs_number_max", max
);
324 output_short_table (&format_obstack
, prhs
, 0, 1, nrules
+ 1);
325 muscle_insert ("prhs", obstack_finish (&format_obstack
));
327 output_short_table (&format_obstack
, rline
, 0, 1, nrules
+ 1);
328 muscle_insert ("rline", obstack_finish (&format_obstack
));
330 output_short_table (&format_obstack
, r1
, 0, 1, nrules
+ 1);
331 muscle_insert ("r1", obstack_finish (&format_obstack
));
333 output_short_table (&format_obstack
, r2
, 0, 1, nrules
+ 1);
334 muscle_insert ("r2", obstack_finish (&format_obstack
));
341 /*--------------------------------------------.
342 | Prepare the muscles related to the states. |
343 `--------------------------------------------*/
346 prepare_states (void)
349 short *values
= (short *) alloca (sizeof (short) * nstates
);
350 for (i
= 0; i
< nstates
; ++i
)
351 values
[i
] = states
[i
]->accessing_symbol
;
352 output_short_table (&format_obstack
, values
,
354 muscle_insert ("stos", obstack_finish (&format_obstack
));
358 /*------------------------------------------------------------------.
359 | Decide what to do for each type of token if seen as the lookahead |
360 | token in specified state. The value returned is used as the |
361 | default action (yydefact) for the state. In addition, actrow is |
362 | filled with what to do for each kind of token, index by symbol |
363 | number, with zero meaning do the default action. The value |
364 | SHRT_MIN, a very negative number, means this situation is an |
365 | error. The parser recognizes this value specially. |
367 | This is where conflicts are resolved. The loop over lookahead |
368 | rules considered lower-numbered rules last, and the last rule |
369 | considered that likes a token gets to handle it. |
370 `------------------------------------------------------------------*/
373 action_row (state_t
*state
)
376 int default_rule
= 0;
377 reductions
*redp
= state
->reductions
;
378 shifts
*shiftp
= state
->shifts
;
379 errs
*errp
= state
->errs
;
380 /* set nonzero to inhibit having any default reduction */
383 for (i
= 0; i
< ntokens
; i
++)
386 if (redp
->nreds
>= 1)
389 /* loop over all the rules available here which require
391 for (i
= state
->nlookaheads
- 1; i
>= 0; --i
)
392 /* and find each token which the rule finds acceptable
394 for (j
= 0; j
< ntokens
; j
++)
395 /* and record this rule as the rule to use if that
397 if (bitset_test (LA
[state
->lookaheadsp
+ i
], j
))
398 actrow
[j
] = -LArule
[state
->lookaheadsp
+ i
]->number
;
401 /* Now see which tokens are allowed for shifts in this state. For
402 them, record the shift as the thing to do. So shift is preferred
404 for (i
= 0; i
< shiftp
->nshifts
; i
++)
407 int shift_state
= shiftp
->shifts
[i
];
411 symbol
= states
[shift_state
]->accessing_symbol
;
416 actrow
[symbol
] = shift_state
;
418 /* Do not use any default reduction if there is a shift for
420 if (symbol
== errtoken
->number
)
424 /* See which tokens are an explicit error in this state (due to
425 %nonassoc). For them, record SHRT_MIN as the action. */
426 for (i
= 0; i
< errp
->nerrs
; i
++)
428 int symbol
= errp
->errs
[i
];
429 actrow
[symbol
] = SHRT_MIN
;
432 /* Now find the most common reduction and make it the default action
435 if (redp
->nreds
>= 1 && !nodefault
)
437 if (state
->consistent
)
438 default_rule
= redp
->rules
[0];
442 for (i
= 0; i
< state
->nlookaheads
; i
++)
445 int rule
= -LArule
[state
->lookaheadsp
+ i
]->number
;
448 for (j
= 0; j
< ntokens
; j
++)
449 if (actrow
[j
] == rule
)
459 /* actions which match the default are replaced with zero,
460 which means "use the default" */
465 for (j
= 0; j
< ntokens
; j
++)
466 if (actrow
[j
] == default_rule
)
469 default_rule
= -default_rule
;
474 /* If have no default rule, the default is an error.
475 So replace any action which says "error" with "use default". */
477 if (default_rule
== 0)
478 for (i
= 0; i
< ntokens
; i
++)
479 if (actrow
[i
] == SHRT_MIN
)
496 for (i
= 0; i
< ntokens
; i
++)
503 froms
[state
] = sp1
= sp
= XCALLOC (short, count
);
504 tos
[state
] = sp2
= XCALLOC (short, count
);
506 for (i
= 0; i
< ntokens
; i
++)
513 tally
[state
] = count
;
514 width
[state
] = sp1
[-1] - sp
[0] + 1;
518 /*------------------------------------------------------------------.
519 | Figure out the actions for the specified state, indexed by |
520 | lookahead token type. |
522 | The YYDEFACT table is output now. The detailed info is saved for |
523 | putting into YYTABLE later. |
524 `------------------------------------------------------------------*/
530 short *yydefact
= XCALLOC (short, nstates
);
532 actrow
= XCALLOC (short, ntokens
);
533 for (i
= 0; i
< nstates
; ++i
)
535 yydefact
[i
] = action_row (states
[i
]);
539 output_short_table (&format_obstack
, yydefact
,
540 yydefact
[0], 1, nstates
);
541 muscle_insert ("defact", obstack_finish (&format_obstack
));
548 /*-----------------------------.
549 | Output the actions to OOUT. |
550 `-----------------------------*/
553 actions_output (FILE *out
)
556 for (rule
= 1; rule
< nrules
+ 1; ++rule
)
557 if (rules
[rule
].action
)
559 fprintf (out
, " case %d:\n", rule
);
562 fprintf (out
, muscle_find ("linef"),
563 rules
[rule
].action_line
,
564 quotearg_style (c_quoting_style
,
565 muscle_find ("filename")));
566 /* As a Bison extension, add the ending semicolon. Since some
567 Yacc don't do that, help people using bison as a Yacc
568 finding their missing semicolons. */
569 fprintf (out
, "{ %s%s }\n break;\n\n",
571 yacc_flag
? ";" : "");
576 /*----------------------------.
577 | Output the guards to OOUT. |
578 `----------------------------*/
581 guards_output (FILE *out
)
584 for (rule
= 1; rule
< nrules
+ 1; ++rule
)
585 if (rules
[rule
].guard
)
587 fprintf (out
, " case %d:\n", rule
);
590 fprintf (out
, muscle_find ("linef"),
591 rules
[rule
].guard_line
,
592 quotearg_style (c_quoting_style
,
593 muscle_find ("filename")));
594 fprintf (out
, "{ %s; }\n break;\n\n",
600 /*---------------------------------------.
601 | Output the tokens definition to OOUT. |
602 `---------------------------------------*/
605 token_definitions_output (FILE *out
)
609 for (i
= 0; i
< ntokens
; ++i
)
611 symbol_t
*symbol
= symbols
[i
];
612 int number
= symbol
->user_token_number
;
614 if (number
== SALIAS
)
616 /* Skip error token. */
617 if (symbol
== errtoken
)
619 if (symbol
->tag
[0] == '\'')
620 continue; /* skip literal character */
621 if (symbol
->tag
[0] == '\"')
623 /* use literal string only if given a symbol with an alias */
625 symbol
= symbol
->alias
;
630 /* Don't #define nonliteral tokens whose names contain periods
631 or '$' (as does the default value of the EOF token). */
632 if (strchr (symbol
->tag
, '.') || strchr (symbol
->tag
, '$'))
635 fprintf (out
, "%s [[[%s]], [%d]]",
636 first
? "" : ",\n", symbol
->tag
, number
);
638 /* FIXME: This is probably wrong, and should be just as
640 fprintf (out
, "# define T%s\t%d\n", symbol
->tag
, symbol
->number
);
647 save_column (int symbol
, int default_state
)
654 int symno
= symbol
- ntokens
+ nstates
;
656 short begin
= goto_map
[symbol
];
657 short end
= goto_map
[symbol
+ 1];
660 for (i
= begin
; i
< end
; i
++)
661 if (to_state
[i
] != default_state
)
667 froms
[symno
] = sp1
= sp
= XCALLOC (short, count
);
668 tos
[symno
] = sp2
= XCALLOC (short, count
);
670 for (i
= begin
; i
< end
; i
++)
671 if (to_state
[i
] != default_state
)
673 *sp1
++ = from_state
[i
];
674 *sp2
++ = to_state
[i
];
677 tally
[symno
] = count
;
678 width
[symno
] = sp1
[-1] - sp
[0] + 1;
682 default_goto (int symbol
)
685 size_t m
= goto_map
[symbol
];
686 size_t n
= goto_map
[symbol
+ 1];
687 int default_state
= -1;
693 for (i
= 0; i
< nstates
; i
++)
696 for (i
= m
; i
< n
; i
++)
697 state_count
[to_state
[i
]]++;
699 for (i
= 0; i
< nstates
; i
++)
700 if (state_count
[i
] > max
)
702 max
= state_count
[i
];
706 return default_state
;
710 /*-------------------------------------------------------------------.
711 | Figure out what to do after reducing with each rule, depending on |
712 | the saved state from before the beginning of parsing the data that |
713 | matched this rule. |
715 | The YYDEFGOTO table is output now. The detailed info is saved for |
716 | putting into YYTABLE later. |
717 `-------------------------------------------------------------------*/
723 short *yydefgoto
= XMALLOC (short, nsyms
- ntokens
);
725 state_count
= XCALLOC (short, nstates
);
726 for (i
= ntokens
; i
< nsyms
; ++i
)
728 int default_state
= default_goto (i
);
729 save_column (i
, default_state
);
730 yydefgoto
[i
- ntokens
] = default_state
;
733 output_short_table (&format_obstack
, yydefgoto
,
734 yydefgoto
[0], 1, nsyms
- ntokens
);
735 muscle_insert ("defgoto", obstack_finish (&format_obstack
));
742 /* The next few functions decide how to pack the actions and gotos
743 information into yytable. */
750 order
= XCALLOC (short, nvectors
);
753 for (i
= 0; i
< nvectors
; i
++)
759 int j
= nentries
- 1;
761 while (j
>= 0 && (width
[order
[j
]] < w
))
764 while (j
>= 0 && (width
[order
[j
]] == w
) && (tally
[order
[j
]] < t
))
767 for (k
= nentries
- 1; k
> j
; k
--)
768 order
[k
+ 1] = order
[k
];
777 matching_state (int vector
)
779 int i
= order
[vector
];
784 if (i
>= (int) nstates
)
790 for (prev
= vector
- 1; prev
>= 0; prev
--)
796 if (width
[j
] != w
|| tally
[j
] != t
)
799 for (k
= 0; match
&& k
< t
; k
++)
800 if (tos
[j
][k
] != tos
[i
][k
] || froms
[j
][k
] != froms
[i
][k
])
810 /* FIXME: For the time being, best approximation... */
811 #define MAXTABLE SHRT_MAX
814 pack_vector (int vector
)
816 int i
= order
[vector
];
820 short *from
= froms
[i
];
825 for (j
= lowzero
- from
[0]; j
< MAXTABLE
; j
++)
830 for (k
= 0; ok
&& k
< t
; k
++)
834 fatal (_("maximum table size (%d) exceeded"), MAXTABLE
);
840 for (k
= 0; ok
&& k
< vector
; k
++)
846 for (k
= 0; k
< t
; k
++)
850 check
[loc
] = from
[k
];
853 while (table
[lowzero
] != 0)
862 #define pack_vector_succeeded 0
863 assert (pack_vector_succeeded
);
875 base
= XCALLOC (short, nvectors
);
876 pos
= XCALLOC (short, nentries
);
877 table
= XCALLOC (short, MAXTABLE
);
878 check
= XCALLOC (short, MAXTABLE
);
883 for (i
= 0; i
< nvectors
; i
++)
886 for (i
= 0; i
< MAXTABLE
; i
++)
889 for (i
= 0; i
< nentries
; i
++)
891 state
= matching_state (i
);
894 place
= pack_vector (i
);
899 base
[order
[i
]] = place
;
902 for (i
= 0; i
< nvectors
; i
++)
913 /* the following functions output yytable, yycheck
914 and the vectors whose elements index the portion starts */
920 output_short_table (&format_obstack
, base
,
921 base
[0], 1, nstates
);
922 muscle_insert ("pact", obstack_finish (&format_obstack
));
925 output_short_table (&format_obstack
, base
,
926 base
[nstates
], nstates
+ 1, nvectors
);
927 muscle_insert ("pgoto", obstack_finish (&format_obstack
));
936 output_short_table (&format_obstack
, table
,
937 table
[0], 1, high
+ 1);
938 muscle_insert ("table", obstack_finish (&format_obstack
));
946 output_short_table (&format_obstack
, check
,
947 check
[0], 1, high
+ 1);
948 muscle_insert ("check", obstack_finish (&format_obstack
));
952 /*-----------------------------------------------------------------.
953 | Compute and output yydefact, yydefgoto, yypact, yypgoto, yytable |
955 `-----------------------------------------------------------------*/
958 output_actions (void)
961 nvectors
= nstates
+ nvars
;
963 froms
= XCALLOC (short *, nvectors
);
964 tos
= XCALLOC (short *, nvectors
);
965 tally
= XCALLOC (short, nvectors
);
966 width
= XCALLOC (short, nvectors
);
973 XFREE (goto_map
+ ntokens
);
985 for (i
= 0; i
< nstates
; ++i
)
987 free (states
[i
]->shifts
);
988 XFREE (states
[i
]->reductions
);
989 free (states
[i
]->errs
);
996 /*---------------------------.
997 | Call the skeleton parser. |
998 `---------------------------*/
1001 output_skeleton (void)
1003 /* Store the definition of all the muscles. */
1004 const char *tempdir
= getenv ("TMPDIR");
1005 char *tempfile
= NULL
;
1009 if (tempdir
== NULL
)
1010 tempdir
= DEFAULT_TMPDIR
;
1011 tempfile
= xmalloc (strlen (tempdir
) + 11);
1012 sprintf (tempfile
, "%s/bsnXXXXXX", tempdir
);
1013 fd
= mkstemp (tempfile
);
1015 error (EXIT_FAILURE
, errno
, "%s", tempfile
);
1017 out
= fdopen (fd
, "w");
1019 error (EXIT_FAILURE
, errno
, "%s", tempfile
);
1021 /* There are no comments, especially not `#': we do want M4 expansion
1022 after `#': think of CPP macros! */
1023 fputs ("m4_changecom()\n", out
);
1024 fputs ("m4_init()\n", out
);
1026 fputs ("m4_define([b4_actions], \n[[", out
);
1027 actions_output (out
);
1028 fputs ("]])\n\n", out
);
1030 fputs ("m4_define([b4_guards], \n[[", out
);
1031 guards_output (out
);
1032 fputs ("]])\n\n", out
);
1034 fputs ("m4_define([b4_tokens], \n[", out
);
1035 token_definitions_output (out
);
1036 fputs ("])\n\n", out
);
1038 muscles_m4_output (out
);
1040 fputs ("m4_wrap([m4_divert_pop(0)])\n", out
);
1041 fputs ("m4_divert_push(0)dnl\n", out
);
1044 /* Invoke m4 on the definition of the muscles, and the skeleton. */
1046 const char *bison_pkgdatadir
= getenv ("BISON_PKGDATADIR");
1047 const char *m4
= getenv ("M4");
1050 if (!bison_pkgdatadir
)
1051 bison_pkgdatadir
= PKGDATADIR
;
1054 "running: %s -I %s m4sugar/m4sugar.m4 %s %s\n",
1055 m4
, bison_pkgdatadir
, tempfile
, skeleton
);
1056 skel_in
= readpipe (m4
,
1057 "-I", bison_pkgdatadir
,
1058 "m4sugar/m4sugar.m4",
1063 error (EXIT_FAILURE
, errno
, "cannot run m4");
1066 /* If `debugging', keep this file alive. */
1075 MUSCLE_INSERT_INT ("last", high
);
1076 MUSCLE_INSERT_INT ("flag", SHRT_MIN
);
1077 MUSCLE_INSERT_INT ("pure", pure_parser
);
1078 MUSCLE_INSERT_INT ("nsym", nsyms
);
1079 MUSCLE_INSERT_INT ("debug", debug_flag
);
1080 MUSCLE_INSERT_INT ("final", final_state
);
1081 MUSCLE_INSERT_INT ("undef_token_number", undeftoken
->number
);
1082 MUSCLE_INSERT_INT ("user_token_number_max", max_user_token_number
);
1083 MUSCLE_INSERT_INT ("error_verbose", error_verbose
);
1084 MUSCLE_INSERT_STRING ("prefix", spec_name_prefix
? spec_name_prefix
: "yy");
1086 /* FIXME: This is wrong: the muscles should decide whether they hold
1087 a copy or not, but the situation is too obscure currently. */
1088 MUSCLE_INSERT_STRING ("output_infix", output_infix
? output_infix
: "");
1089 MUSCLE_INSERT_STRING ("output_prefix", short_base_name
);
1090 MUSCLE_INSERT_STRING ("output_parser_name", parser_file_name
);
1091 MUSCLE_INSERT_STRING ("output_header_name", spec_defines_file
);
1093 MUSCLE_INSERT_INT ("nnts", nvars
);
1094 MUSCLE_INSERT_INT ("nrules", nrules
);
1095 MUSCLE_INSERT_INT ("nstates", nstates
);
1096 MUSCLE_INSERT_INT ("ntokens", ntokens
);
1098 MUSCLE_INSERT_INT ("locations_flag", locations_flag
);
1099 MUSCLE_INSERT_INT ("defines_flag", defines_flag
);
1101 /* Copy definitions in directive. */
1102 obstack_1grow (&attrs_obstack
, 0);
1103 muscle_insert ("prologue", obstack_finish (&attrs_obstack
));
1105 /* Find the right skeleton file. */
1108 if (semantic_parser
)
1109 skeleton
= "bison.hairy";
1111 skeleton
= "bison.simple";
1114 /* Parse the skeleton file and output the needed parsers. */
1115 muscle_insert ("skeleton", skeleton
);
1119 /*----------------------------------------------------------.
1120 | Output the parsing tables and the parser code to ftable. |
1121 `----------------------------------------------------------*/
1126 obstack_init (&format_obstack
);
1135 /* Process the selected skeleton file. */
1138 obstack_free (&muscle_obstack
, NULL
);
1139 obstack_free (&format_obstack
, NULL
);
1140 obstack_free (&action_obstack
, NULL
);
1141 obstack_free (&attrs_obstack
, NULL
);