style: rename stmtMerge as stmt_merge
[bison.git] / TODO
bloba4a91bb02fc3a324c16f0a7a15cd4df5a2b97813
1 * Soon
2 ** scan-code
3 The default case is scanning char-per-char.
5     /* By default, grow the string obstack with the input.  */
6     .|\n        STRING_GROW ();
8 make it more eager?
10 ** Missing tests
11 commit 2c294c132528ede23d8ae4959783a67e9ff05ac5
12 Author: Vincent Imbimbo <vmi6@cornell.edu>
13 Date:   Sat Jan 23 13:25:18 2021 -0500
15     cex: fix state-item pruning
17 See https://lists.gnu.org/r/bug-bison/2021-01/msg00002.html
19 ** pos_set_set
20 The current approach is correct, but with poor performances.  Bitsets need
21 to support 'assign' and 'shift'.  And instead of extending POS_SET just for
22 the out-of-range new values, we need something like doubling the size.
24 ** glr
25 There is no test with "Parse on stack %ld rejected by rule %d" in it.
27 ** yyrline etc.
28 Clarify that rule numbers in the skeletons are 1-based.
30 ** Macros in C++
31 There are many macros that should obey api.prefix: YY_CPLUSPLUS, YY_MOVE,
32 etc.
34 ** yyerrok in Java
35 And add tests in calc.at, to prepare work for D.
37 ** YYERROR and yynerrs
38 We are missing some cases.  Write a test case, and check all the skeletons.
40 ** Cex
41 *** Improve gnulib
42 Don't do this (counterexample.c):
44 // This is the fastest way to get the tail node from the gl_list API.
45 gl_list_node_t
46 list_get_end (gl_list_t list)
48   gl_list_node_t sentinel = gl_list_add_last (list, NULL);
49   gl_list_node_t res = gl_list_previous_node (list, sentinel);
50   gl_list_remove_node (list, sentinel);
51   return res;
54 *** Ambiguous rewriting
55 If the user is stupid enough to have equal rules, then the derivations are
56 harder to read:
58     Reduce/reduce conflict on tokens $end, "+", "⊕":
59         2 exp: exp "+" exp .
60         3 exp: exp "+" exp .
61       Example                  exp "+" exp •
62       First derivation         exp ::=[ exp "+" exp • ]
63       Example                  exp "+" exp •
64       Second derivation        exp ::=[ exp "+" exp • ]
66 Do we care about this?  In color, we use twice the same color here, but we
67 could try to use the same color for the same rule.
69 *** XML reports
70 Show the counterexamples.  This is going to be really hard and/or painful.
71 Unless we play it dumb (little structure).
73 ** Bistromathic
74 - How about not evaluating incomplete lines when the text is not finished
75   (as shells do).
77 ** Questions
78 *** Java
79 - Should i18n be part of the Lexer?  Currently it's a static method of
80   Lexer.
82 - is there a migration path that would allow to use TokenKinds in
83   yylex?
85 - define the tokens as an enum too.
87 - promote YYEOF rather than EOF.
89 ** YYerror
90 https://git.savannah.gnu.org/gitweb/?p=gettext.git;a=blob;f=gettext-runtime/intl/plural.y;h=a712255af4f2f739c93336d4ff6556d932a426a5;hb=HEAD
92 should be updated to not use YYERRCODE.  Returning an undef token is good
93 enough.
95 ** Java
96 *** calc.at
97 Stop hard-coding "Calc".  Adjust local.at (look for FIXME).
99 ** doc
100 I feel it's ugly to use the GNU style to declare functions in the doc.  It
101 generates tons of white space in the page, and may contribute to bad page
102 breaks.
104 ** consistency
105 token vs terminal.
107 ** api.token.raw
108 The YYUNDEFTOK could be assigned a semantic value so that yyerror could be
109 used to report invalid lexemes.
111 ** push parsers
112 Consider deprecating impure push parsers.  They add a lot of complexity, for
113 a bad feature.  On the other hand, that would make it much harder to sit
114 push parsers on top of pull parser.  Which is currently not relevant, since
115 push parsers are measurably slower.
117 ** %define parse.error formatted
118 How about pushing Bistromathic's yyreport_syntax_error as another standard
119 way to generate the error message, and leave to the user the task of
120 providing the message formats?  Currently in bistro, it reads:
122     const char *
123     error_format_string (int argc)
124     {
125       switch (argc)
126         {
127         default: /* Avoid compiler warnings. */
128         case 0: return _("%@: syntax error");
129         case 1: return _("%@: syntax error: unexpected %u");
130           // TRANSLATORS: '%@' is a location in a file, '%u' is an
131           // "unexpected token", and '%0e', '%1e'... are expected tokens
132           // at this point.
133           //
134           // For instance on the expression "1 + * 2", you'd get
135           //
136           // 1.5: syntax error: expected - or ( or number or function or variable before *
137         case 2: return _("%@: syntax error: expected %0e before %u");
138         case 3: return _("%@: syntax error: expected %0e or %1e before %u");
139         case 4: return _("%@: syntax error: expected %0e or %1e or %2e before %u");
140         case 5: return _("%@: syntax error: expected %0e or %1e or %2e or %3e before %u");
141         case 6: return _("%@: syntax error: expected %0e or %1e or %2e or %3e or %4e before %u");
142         case 7: return _("%@: syntax error: expected %0e or %1e or %2e or %3e or %4e or %5e before %u");
143         case 8: return _("%@: syntax error: expected %0e or %1e or %2e or %3e or %4e or %5e or %6e before %u");
144         }
145     }
147 The message would have to be generated in a string, and pushed to yyerror.
148 Which will be a pain in the neck in yacc.c.
150 If we want to do that, we should think very carefully about the syntax of
151 the format string.
153 ** yyclearin does not invoke the lookahead token's %destructor
154 https://lists.gnu.org/r/bug-bison/2018-02/msg00000.html
155 Rici:
157 > Modifying yyclearin so that it calls yydestruct seems like the simplest
158 > solution to this issue, but it is conceivable that such a change would
159 > break programs which already perform some kind of workaround in order to
160 > destruct the lookahead symbol. So it might be necessary to use some kind of
161 > compatibility %define, or to create a new replacement macro with a
162 > different name such as yydiscardin.
164 > At a minimum, the fact that yyclearin does not invoke the %destructor
165 > should be highlighted in the documentation, since it is not at all obvious.
167 ** Issues in i18n
169 Les catégories d'avertissements incluent :
170   conflicts-sr      conflits S/R (activé par défaut)
171   conflicts-rr      conflits R/R (activé par défaut)
172   dangling-alias    l'alias chaîne n'est pas attaché à un symbole
173   deprecated        construction obsolète
174   empty-rule        règle vide sans %empty
175   midrule-values    valeurs de règle intermédiaire non définies ou inutilisées
176   precedence        priorité et associativité inutiles
177   yacc              incompatibilités avec POSIX Yacc
178   other             tous les autres avertissements (activé par défaut)
179   all               tous les avertissements sauf « dangling-alias » et « yacc »
180   no-CATEGORY       désactiver les avertissements dans CATEGORIE
181   none              désactiver tous les avertissements
182   error[=CATEGORY]  traiter les avertissements comme des erreurs
184 Line -1 and -3 should mention CATEGORIE, not CATEGORY.
186 * Bison 3.9
187 ** Rewrite glr.cc (currently glr2.cc)
188 *** custom error messages
190 *** Remove jumps
191 We can probably replace setjmp/longjmp with exceptions.  That would help
192 tremendously other languages such as D and Java that probably have no
193 similar feature.  If we remove jumps, we probably no longer need _Noreturn,
194 so simplify `b4_attribute_define([noreturn])` into `b4_attribute_define`.
196 After discussing with Valentin, it was decided that it's better to stay with
197 jumps, since in some places exceptions are ruled out from C++.
199 *** Coding style
200 Move to our coding conventions.  In particular names such as yy_glr_stack,
201 not yyGLRStack.
203 *** yydebug
204 It should be a member of the parser object, see lalr1.cc.  Let the parser
205 object decide what the debug stream is, rather than open coding std::cerr.
207 *** Avoid pointers
208 There are many places where pointers should be replaced with references.
209 Some occurrences were fixed, but now some have improper names:
211 -yygetToken (int *yycharp, ]b4_namespace_ref[::]b4_parser_class[& yyparser][]b4_pure_if([, glr_stack* yystackp])[]b4_user_formals[)
212 +yygetToken (int& yycharp, ]b4_namespace_ref[::]b4_parser_class[& yyparser][]b4_pure_if([, glr_stack* yystackp])[]b4_user_formals[)
214 yycharp is no longer a Pointer.  And yystackp should probably also be a reference.
216 *** parse.assert
217 Currently all the assertions are enabled.  Once we are confident in glr2.cc,
218 let parse.assert use the same approach as in lalr1.cc.
220 *** debug_stream
221 Stop using std::cerr everywhere.
223 *** glr.c
224 When glr2.cc fully replaces glr.cc, get rid of the glr.cc scaffolding in
225 glr.c.
227 * Chains
228 ** Unit rules / Injection rules (Akim Demaille)
229 Maybe we could expand unit rules (or "injections", see
230 https://homepages.cwi.nl/~daybuild/daily-books/syntax/2-sdf/sdf.html), i.e.,
231 transform
233         exp: arith | bool;
234         arith: exp '+' exp;
235         bool: exp '&' exp;
237 into
239         exp: exp '+' exp | exp '&' exp;
241 when there are no actions.  This can significantly speed up some grammars.
242 I can't find the papers.  In particular the book 'LR parsing: Theory and
243 Practice' is impossible to find, but according to 'Parsing Techniques: a
244 Practical Guide', it includes information about this issue.  Does anybody
245 have it?
247 ** clean up (Akim Demaille)
248 Do not work on these items now, as I (Akim) have branches with a lot of
249 changes in this area (hitting several files), and no desire to have to fix
250 conflicts.  Addressing these items will happen after my branches have been
251 merged.
253 *** lalr.c
254 Introduce a goto struct, and use it in place of from_state/to_state.
255 Rename states1 as path, length as pathlen.
256 Introduce inline functions for things such as nullable[*rp - ntokens]
257 where we need to map from symbol number to nterm number.
259 There are probably a significant part of the relations management that
260 should be migrated on top of a bitsetv.
262 *** closure
263 It should probably take a "state*" instead of two arguments.
265 *** traces
266 The "automaton" and "set" categories are not so useful.  We should probably
267 introduce lr(0) and lalr, just the way we have ielr categories.  The
268 "closure" function is too verbose, it should probably have its own category.
270 "set" can still be used for summarizing the important sets.  That would make
271 tests easy to maintain.
273 *** complain.*
274 Rename these guys as "diagnostics.*" (or "diagnose.*"), since that's the
275 name they have in GCC, clang, etc.  Likewise for the complain_* series of
276 functions.
278 *** ritem
279 states/nstates, rules/nrules, ..., ritem/nritems
280 Fix the latter.
282 *** m4: slot, type, type_tag
283 The meaning of type_tag varies depending on api.value.type.  We should avoid
284 that and using clear definitions with stable semantics.
286 * D programming language
287 There's a number of features that are missing, here sorted in _suggested_
288 order of implementation.
290 When copying code from other skeletons, keep the comments exactly as they
291 are.  Keep the same variable names.  If you change the wording in one place,
292 do it in the others too.  In other words: make sure to keep the
293 maintenance *simple* by avoiding any gratuitous difference.
295 ** CI
296 Check when gdc and ldc.
298 ** GLR Parser
299 This is very ambitious.  That's the final boss.  There are currently no
300 "clean" implementation to get inspiration from.
302 glr.c is very clean but:
303 - is low-level C
304 - is a different skeleton from yacc.c
306 glr.cc is (currently) an ugly hack: a C++ shell around glr.c.  Valentin
307 Tolmer is currently rewriting glr.cc to be clean C++, but he is not
308 finished.  There will be a lot a common code between lalr1.cc and glr.cc, so
309 eventually I would like them to be fused into a single skeleton, supporting
310 both deterministic and generalized parsing.
312 It would be great for D to also support this.
314 The basic ideas of GLR are explained here:
316 https://www.codeproject.com/Articles/5259825/GLR-Parsing-in-Csharp-How-to-Use-The-Most-Powerful
318 * Better error messages
319 The users are not provided with enough tools to forge their error messages.
320 See for instance "Is there an option to change the message produced by
321 YYERROR_VERBOSE?" by Simon Sobisch, on bison-help.
323 See also
324 https://www.cs.tufts.edu/~nr/cs257/archive/clinton-jefferey/lr-error-messages.pdf
325 https://research.swtch.com/yyerror
326 http://gallium.inria.fr/~fpottier/publis/fpottier-reachability-cc2016.pdf
328 * Modernization
329 Fix data/skeletons/yacc.c so that it defines YYPTRDIFF_T properly for modern
330 and older C++ compilers.  Currently the code defaults to defining it to
331 'long' for non-GCC compilers, but it should use the proper C++ magic to
332 define it to the same type as the C ptrdiff_t type.
334 * Completion
335 Several features are not available in all the back-ends.
337 - push parsers: glr.c, glr.cc, lalr1.cc (not very difficult)
338 - token constructors: Java, C, D (a bit difficult)
339 - glr: D, Java (super difficult)
341 * Bugs
342 ** Autotest has quotation issues
343 tests/input.at:1730:AT_SETUP([%define errors])
347 $ ./tests/testsuite -l | grep errors | sed q
348   38: input.at:1730      errors
350 * Short term
351 ** Better design for diagnostics
352 The current implementation of diagnostics is ad hoc, it grew organically.
353 It works as a series of calls to several functions, with dependency of the
354 latter calls on the former.  For instance:
356       complain (&sym->location,
357                 sym->content->status == needed ? complaint : Wother,
358                 _("symbol %s is used, but is not defined as a token"
359                   " and has no rules; did you mean %s?"),
360                 quote_n (0, sym->tag),
361                 quote_n (1, best->tag));
362       if (feature_flag & feature_caret)
363         location_caret_suggestion (sym->location, best->tag, stderr);
365 We should rewrite this in a more FP way:
367 1. build a rich structure that denotes the (complete) diagnostic.
368    "Complete" in the sense that it also contains the suggestions, the list
369    of possible matches, etc.
371 2. send this to the pretty-printing routine.  The diagnostic structure
372    should be sufficient so that we can generate all the 'format' of
373    diagnostics, including the fixits.
375 If properly done, this diagnostic module can be detached from Bison and be
376 put in gnulib.  It could be used, for instance, for errors caught by
377 xgettext.
379 There's certainly already something alike in GCC.  At least that's the
380 impression I get from reading the "-fdiagnostics-format=FORMAT" part of this
381 page:
383 https://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Message-Formatting-Options.html
385 ** Graphviz display code thoughts
386 The code for the --graph option is over two files: print_graph, and
387 graphviz. This is because Bison used to also produce VCG graphs, but since
388 this is no longer true, maybe we could consider these files for fusion.
390 An other consideration worth noting is that print_graph.c (correct me if I
391 am wrong) should contain generic functions, whereas graphviz.c and other
392 potential files should contain just the specific code for that output
393 format. It will probably prove difficult to tell if the implementation is
394 actually generic whilst only having support for a single format, but it
395 would be nice to keep stuff a bit tidier: right now, the construction of the
396 bitset used to show reductions is in the graphviz-specific code, and on the
397 opposite side we have some use of \l, which is graphviz-specific, in what
398 should be generic code.
400 Little effort seems to have been given to factoring these files and their
401 print{,-xml} counterpart. We would very much like to re-use the pretty format
402 of states from .output for the graphs, etc.
404 Since graphviz dies on medium-to-big grammars, maybe consider an other tool?
406 ** push-parser
407 Check it too when checking the different kinds of parsers.  And be
408 sure to check that the initial-action is performed once per parsing.
410 ** m4 names
411 b4_shared_declarations is no longer what it is.  Make it
412 b4_parser_declaration for instance.
414 ** yychar in lalr1.cc
415 There is a large difference bw maint and master on the handling of
416 yychar (which was removed in lalr1.cc).  See what needs to be
417 back-ported.
420     /* User semantic actions sometimes alter yychar, and that requires
421        that yytoken be updated with the new translation.  We take the
422        approach of translating immediately before every use of yytoken.
423        One alternative is translating here after every semantic action,
424        but that translation would be missed if the semantic action
425        invokes YYABORT, YYACCEPT, or YYERROR immediately after altering
426        yychar.  In the case of YYABORT or YYACCEPT, an incorrect
427        destructor might then be invoked immediately.  In the case of
428        YYERROR, subsequent parser actions might lead to an incorrect
429        destructor call or verbose syntax error message before the
430        lookahead is translated.  */
432     /* Make sure we have latest lookahead translation.  See comments at
433        user semantic actions for why this is necessary.  */
434     yytoken = yytranslate_ (yychar);
437 ** Get rid of fake #lines [Bison: ...]
438 Possibly as simple as checking whether the column number is nonnegative.
440 I have seen messages like the following from GCC.
442 <built-in>:0: fatal error: opening dependency file .deps/libltdl/argz.Tpo: No such file or directory
445 ** Discuss about %printer/%destroy in the case of C++.
446 It would be very nice to provide the symbol classes with an operator<<
447 and a destructor.  Unfortunately the syntax we have chosen for
448 %destroy and %printer make them hard to reuse.  For instance, the user
449 is invited to write something like
451    %printer { debug_stream() << $$; } <my_type>;
453 which is hard to reuse elsewhere since it wants to use
454 "debug_stream()" to find the stream to use.  The same applies to
455 %destroy: we told the user she could use the members of the Parser
456 class in the printers/destructors, which is not good for an operator<<
457 since it is no longer bound to a particular parser, it's just a
458 (standalone symbol).
460 * Various
461 ** Rewrite glr.cc in C++ (Valentin Tolmer)
462 As a matter of fact, it would be very interesting to see how much we can
463 share between lalr1.cc and glr.cc.  Most of the skeletons should be common.
464 It would be a very nice source of inspiration for the other languages.
466 Valentin Tolmer is working on this.
468 * From lalr1.cc to yacc.c
469 ** Single stack
470 Merging the three stacks in lalr1.cc simplified the code, prompted for
471 other improvements and also made it faster (probably because memory
472 management is performed once instead of three times).  I suggest that
473 we do the same in yacc.c.
475 (Some time later): it's also very nice to have three stacks: it's more dense
476 as we don't lose bits to padding.  For instance the typical stack for states
477 will use 8 bits, while it is likely to consume 32 bits in a struct.
479 We need trustworthy benchmarks for Bison, for all our backends.  Akim has a
480 few things scattered around; we need to put them in the repo, and make them
481 more useful.
483 * Report
485 ** Figures
486 Some statistics about the grammar and the parser would be useful,
487 especially when asking the user to send some information about the
488 grammars she is working on.  We should probably also include some
489 information about the variables (I'm not sure for instance we even
490 specify what LR variant was used).
492 ** GLR
493 How would Paul like to display the conflicted actions?  In particular,
494 what when two reductions are possible on a given lookahead token, but one is
495 part of $default.  Should we make the two reductions explicit, or just
496 keep $default?  See the following point.
498 ** Disabled Reductions
499 See 'tests/conflicts.at (Defaulted Conflicted Reduction)', and decide
500 what we want to do.
502 ** Documentation
503 Extend with error productions.  The hard part will probably be finding
504 the right rule so that a single state does not exhibit too many yet
505 undocumented ''features''.  Maybe an empty action ought to be
506 presented too.  Shall we try to make a single grammar with all these
507 features, or should we have several very small grammars?
509 * Extensions
510 ** More languages?
511 Well, only if there is really some demand for it.
513 *** PHP
514 https://github.com/scfc/bison-php/blob/master/data/lalr1.php
516 *** Python
517 https://lists.gnu.org/r/bison-patches/2013-09/msg00000.html and following
519 ** Multiple start symbols
520 Revert a70e75b8a41755ab96ab211a0ea111ac68a4aadd.
522 Would be very useful when parsing closely related languages.  The idea is to
523 declare several start symbols, for instance
525     %start stmt expr
526     %%
527     stmt: ...
528     expr: ...
530 and to generate parse(), parse_stmt() and parse_expr().  Technically, the
531 above grammar would be transformed into
533    %start yy_start
534    %token YY_START_STMT YY_START_EXPR
535    %%
536    yy_start: YY_START_STMT stmt | YY_START_EXPR expr
538 so that there are no new conflicts in the grammar (as would undoubtedly
539 happen with yy_start: stmt | expr).  Then adjust the skeletons so that this
540 initial token (YY_START_STMT, YY_START_EXPR) be shifted first in the
541 corresponding parse function.
543 *** Number of useless symbols
544 AT_TEST(
545 [[%start exp;
546 exp: exp;]],
547 [[input.y: warning: 2 nonterminals useless in grammar [-Wother]
548 input.y: warning: 2 rules useless in grammar [-Wother]
549 input.y:2.8-10: error: start symbol exp does not derive any sentence]])
551 We should say "1 nonterminal": the other one is $accept, which should not
552 participate in the count.
554 *** Tokens
555 Do we want to disallow terminal start symbols?  The limitation is not
556 technical.  Can it be useful to someone to "parse" a token?
558 ** %include
559 This is a popular demand.  We already made many changes in the parser that
560 should make this reasonably easy to implement.
562 Bruce Mardle <marblypup@yahoo.co.uk>
563 https://lists.gnu.org/r/bison-patches/2015-09/msg00000.html
565 However, there are many other things to do before having such a feature,
566 because I don't want a % equivalent to #include (which we all learned to
567 hate).  I want something that builds "modules" of grammars, and assembles
568 them together, paying attention to keep separate bits separated, in pseudo
569 name spaces.
571 ** Push parsers
572 There is demand for push parsers in C++.
574 ** Generate code instead of tables
575 This is certainly quite a lot of work.  See
576 https://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.50.4539.
578 ** $-1
579 We should find a means to provide an access to values deep in the
580 stack.  For instance, instead of
582         baz: qux { $$ = $<foo>-1 + $<bar>0 + $1; }
584 we should be able to have:
586   foo($foo) bar($bar) baz($bar): qux($qux) { $baz = $foo + $bar + $qux; }
588 Or something like this.
590 ** %if and the like
591 It should be possible to have %if/%else/%endif.  The implementation is
592 not clear: should it be lexical or syntactic.  Vadim Maslow thinks it
593 must be in the scanner: we must not parse what is in a switched off
594 part of %if.  Akim Demaille thinks it should be in the parser, so as
595 to avoid falling into another CPP mistake.
597 (Later): I'm sure there's actually good case for this.  People who need that
598 feature can use m4/cpp on top of Bison.  I don't think it is worth the
599 trouble in Bison itself.
601 ** XML Output
602 There are couple of available extensions of Bison targeting some XML
603 output.  Some day we should consider including them.  One issue is
604 that they seem to be quite orthogonal to the parsing technique, and
605 seem to depend mostly on the possibility to have some code triggered
606 for each reduction.  As a matter of fact, such hooks could also be
607 used to generate the yydebug traces.  Some generic scheme probably
608 exists in there.
610 XML output for GNU Bison and gcc
611    http://www.cs.may.ie/~jpower/Research/bisonXML/
613 XML output for GNU Bison
614    http://yaxx.sourceforge.net/
616 * Coding system independence
617 Paul notes:
619         Currently Bison assumes 8-bit bytes (i.e. that UCHAR_MAX is
620         255).  It also assumes that the 8-bit character encoding is
621         the same for the invocation of 'bison' as it is for the
622         invocation of 'cc', but this is not necessarily true when
623         people run bison on an ASCII host and then use cc on an EBCDIC
624         host.  I don't think these topics are worth our time
625         addressing (unless we find a gung-ho volunteer for EBCDIC or
626         PDP-10 ports :-) but they should probably be documented
627         somewhere.
629         More importantly, Bison does not currently allow NUL bytes in
630         tokens, either via escapes (e.g., "x\0y") or via a NUL byte in
631         the source code.  This should get fixed.
633 * Broken options?
634 ** %token-table
635 ** Skeleton strategy
636 Must we keep %token-table?
638 * Precedence
640 ** Partial order
641 It is unfortunate that there is a total order for precedence.  It
642 makes it impossible to have modular precedence information.  We should
643 move to partial orders (sounds like series/parallel orders to me).
645 This is a prerequisite for modules.
647 * Pre and post actions.
648 From: Florian Krohm <florian@edamail.fishkill.ibm.com>
649 Subject: YYACT_EPILOGUE
650 To: bug-bison@gnu.org
651 X-Sent: 1 week, 4 days, 14 hours, 38 minutes, 11 seconds ago
653 The other day I had the need for explicitly building the parse tree. I
654 used %locations for that and defined YYLLOC_DEFAULT to call a function
655 that returns the tree node for the production. Easy. But I also needed
656 to assign the S-attribute to the tree node. That cannot be done in
657 YYLLOC_DEFAULT, because it is invoked before the action is executed.
658 The way I solved this was to define a macro YYACT_EPILOGUE that would
659 be invoked after the action. For reasons of symmetry I also added
660 YYACT_PROLOGUE. Although I had no use for that I can envision how it
661 might come in handy for debugging purposes.
662 All is needed is to add
664 #if YYLSP_NEEDED
665     YYACT_EPILOGUE (yyval, (yyvsp - yylen), yylen, yyloc, (yylsp - yylen));
666 #else
667     YYACT_EPILOGUE (yyval, (yyvsp - yylen), yylen);
668 #endif
670 at the proper place to bison.simple. Ditto for YYACT_PROLOGUE.
672 I was wondering what you think about adding YYACT_PROLOGUE/EPILOGUE
673 to bison. If you're interested, I'll work on a patch.
675 * Better graphics
676 Equip the parser with a means to create the (visual) parse tree.
679 -----
681 # LocalWords:  Cex gnulib gl Bistromathic TokenKinds yylex enum YYEOF EOF
682 # LocalWords:  YYerror gettext af hb YYERRCODE undef calc FIXME dev yyerror
683 # LocalWords:  Autoconf YYUNDEFTOK lexemes parsers Bistromathic's yyreport
684 # LocalWords:  const argc yacc yyclearin lookahead destructor Rici incluent
685 # LocalWords:  yydestruct yydiscardin catégories d'avertissements sr activé
686 # LocalWords:  conflits défaut rr l'alias chaîne n'est attaché un symbole
687 # LocalWords:  obsolète règle vide midrule valeurs de intermédiaire ou avec
688 # LocalWords:  définies inutilisées priorité associativité inutiles POSIX
689 # LocalWords:  incompatibilités tous les autres avertissements sauf dans rp
690 # LocalWords:  désactiver CATEGORIE traiter comme des erreurs glr Akim bool
691 # LocalWords:  Demaille arith lalr goto struct pathlen nullable ntokens lr
692 # LocalWords:  nterm bitsetv ielr ritem nstates nrules nritems yysymbol EQ
693 # LocalWords:  SymbolKind YYEMPTY YYUNDEF YYTNAME NUM yyntokens yytname sed
694 # LocalWords:  nonterminals yykind yycode YYNAMES yynames init getName conv
695 # LocalWords:  TokenKind ival yychar yylval yylexer Tolmer hoc
696 # LocalWords:  Sobisch YYPTRDIFF ptrdiff Autotest toknum yytoknum
697 # LocalWords:  sym Wother stderr FP fixits xgettext fdiagnostics Graphviz
698 # LocalWords:  graphviz VCG bitset xml bw maint yytoken YYABORT deps
699 # LocalWords:  YYACCEPT yytranslate nonnegative destructors yyerrlab repo
700 # LocalWords:  backends stmt expr yy Mardle baz qux Vadim Maslow CPP cpp
701 # LocalWords:  yydebug gcc UCHAR EBCDIC gung PDP NUL Pre Florian Krohm utf
702 # LocalWords:  YYACT YYLLOC YYLSP yyval yyvsp yylen yyloc yylsp endif
703 # LocalWords:  ispell american
705 Local Variables:
706 mode: outline
707 coding: utf-8
708 fill-column: 76
709 ispell-dictionary: "american"
710 End:
712 Copyright (C) 2001-2004, 2006, 2008-2015, 2018-2021 Free Software
713 Foundation, Inc.
715 This file is part of Bison, the GNU Compiler Compiler.
717 Permission is granted to copy, distribute and/or modify this document
718 under the terms of the GNU Free Documentation License, Version 1.3 or
719 any later version published by the Free Software Foundation; with no
720 Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
721 Texts.  A copy of the license is included in the "GNU Free
722 Documentation License" file as part of this distribution.