[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 09/17] multistart: pass the list of start symbols to the backend
From: |
Akim Demaille |
Subject: |
[PATCH 09/17] multistart: pass the list of start symbols to the backend |
Date: |
Sun, 20 Sep 2020 10:37:41 +0200 |
* src/output.c (start_symbols_output): New.
(muscles_output): Use it.
---
src/output.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/src/output.c b/src/output.c
index 64d40e51..a0685dd5 100644
--- a/src/output.c
+++ b/src/output.c
@@ -461,6 +461,27 @@ type_names_output (FILE *out)
}
+/* Define the list of start symbols *if* there are several. Define
+ them by pairs: [START-SYMBOL-NUM, SWITCHING-TOKEN-SYMBOL-NUM]. */
+static void
+start_symbols_output (FILE *out)
+{
+ if (start_symbols && start_symbols->next)
+ {
+ fputs ("m4_define([b4_start_symbols],\n[", out);
+ for (symbol_list *list = start_symbols; list; list = list->next)
+ {
+ const symbol *start = list->content.sym;
+ const symbol *swtok = switching_token (start);
+ fprintf (out, "%s[%d, %d]",
+ list == start_symbols ? "" : ", ",
+ start->content->number, swtok->content->number);
+ }
+ fputs ("])\n\n", out);
+ }
+}
+
+
/*-------------------------------------.
| The list of all the symbol numbers. |
`-------------------------------------*/
@@ -691,6 +712,7 @@ muscles_output (FILE *out)
merger_output (out);
symbol_numbers_output (out);
type_names_output (out);
+ start_symbols_output (out);
user_actions_output (out);
/* Must be last. */
muscles_m4_output (out);
--
2.28.0
- [PATCH 00/17] RFC: multiple start symbols, Akim Demaille, 2020/09/20
- [PATCH 01/17] gram: more debugging information, Akim Demaille, 2020/09/20
- [PATCH 02/17] reader: get ready to create several initial rules, Akim Demaille, 2020/09/20
- [PATCH 03/17] parser: expose a list of symbols, Akim Demaille, 2020/09/20
- [PATCH 04/17] regen, Akim Demaille, 2020/09/20
- [PATCH 05/17] multistart: turn start symbols into rules on $accept, Akim Demaille, 2020/09/20
- [PATCH 06/17] regen, Akim Demaille, 2020/09/20
- [PATCH 07/17] multistart: adjust computation of initial core and adjust reports, Akim Demaille, 2020/09/20
- [PATCH 08/17] multistart: also check the HTML report, Akim Demaille, 2020/09/20
- [PATCH 09/17] multistart: pass the list of start symbols to the backend,
Akim Demaille <=
- [PATCH 10/17] multistart: equip yacc.c, Akim Demaille, 2020/09/20
- [PATCH 11/17] multistart: toy with it in lexcalc, Akim Demaille, 2020/09/20
- [PATCH 12/17] todo: more, Akim Demaille, 2020/09/20
- [PATCH 13/17] multistart: adjust reader checks for generated rules, Akim Demaille, 2020/09/20
- [PATCH 14/17] multistart: use b4_accept instead of action post-processing, Akim Demaille, 2020/09/20
- [PATCH 15/17] multistart: allow tokens as start symbols, Akim Demaille, 2020/09/20
- [PATCH 16/17] yacc.c: also count calls to YYERROR in yynerrs, Akim Demaille, 2020/09/20
- [PATCH 17/17] multistart: also give access to yynerrs, Akim Demaille, 2020/09/20
- Re: [PATCH 00/17] RFC: multiple start symbols, Paul Eggert, 2020/09/20