+/*-----------------------------.
+| Output the actions to OOUT. |
+`-----------------------------*/
+
+void
+actions_output (FILE *out)
+{
+ rule_number_t r;
+
+ fputs ("m4_define([b4_actions], \n[[", out);
+ for (r = 1; r < nrules + 1; ++r)
+ if (rules[r].action)
+ {
+ fprintf (out, " case %d:\n", r);
+
+ if (!no_lines_flag)
+ fprintf (out, muscle_find ("linef"),
+ rules[r].action_location.first_line,
+ quotearg_style (c_quoting_style,
+ muscle_find ("filename")));
+ fprintf (out, " %s\n break;\n\n",
+ rules[r].action);
+ }
+ fputs ("]])\n\n", out);
+}
+
+/*--------------------------------------.
+| Output the merge functions to OUT. |
+`--------------------------------------*/
+
+static void
+merger_output (FILE *out)
+{
+ int n;
+ merger_list* p;
+
+ fputs ("m4_define([b4_mergers], \n[[", out);
+ for (n = 1, p = merge_functions; p != NULL; n += 1, p = p->next)
+ {
+ if (p->type[0] == '\0')
+ fprintf (out, " case %d: yyval = %s (*yy0, *yy1); break;\n",
+ n, p->name);
+ else
+ fprintf (out, " case %d: yyval.%s = %s (*yy0, *yy1); break;\n",
+ n, p->type, p->name);
+ }
+ fputs ("]])\n\n", out);
+}
+
+/*---------------------------------------.
+| Output the tokens definition to OOUT. |
+`---------------------------------------*/
+
+void
+token_definitions_output (FILE *out)
+{
+ int i;
+ int first = 1;
+
+ fputs ("m4_define([b4_tokens], \n[", out);
+ for (i = 0; i < ntokens; ++i)
+ {
+ symbol_t *symbol = symbols[i];
+ int number = symbol->user_token_number;
+
+ /* At this stage, if there are literal aliases, they are part of
+ SYMBOLS, so we should not find symbols which are the aliases
+ here. */
+ assert (number != USER_NUMBER_ALIAS);
+
+ /* Skip error token. */
+ if (symbol == errtoken)
+ continue;
+
+ /* If this string has an alias, then it is necessarily the alias
+ which is to be output. */
+ if (symbol->alias)
+ symbol = symbol->alias;
+
+ /* Don't output literal chars or strings (when defined only as a
+ string). Note that must be done after the alias resolution:
+ think about `%token 'f' "f"'. */
+ if (symbol->tag[0] == '\'' || symbol->tag[0] == '\"')
+ continue;
+
+ /* Don't #define nonliteral tokens whose names contain periods
+ or '$' (as does the default value of the EOF token). */
+ if (strchr (symbol->tag, '.') || strchr (symbol->tag, '$'))
+ continue;
+
+ fprintf (out, "%s[[[%s]], [%d]]",
+ first ? "" : ",\n", symbol->tag, number);
+
+ first = 0;
+ }
+ fputs ("])\n\n", out);
+}
+
+
+/*----------------------------------------.
+| Output the symbol destructors to OOUT. |
+`----------------------------------------*/
+