]> git.saurik.com Git - bison.git/blob - NEWS
Merge remote-tracking branch 'origin/maint'
[bison.git] / NEWS
1 Bison News
2 ----------
3
4 * Changes in version ?.? (????-??-??):
5
6 ** Additional yylex/yyparse arguments
7
8 The new directive %param declare additional argument to both yylex
9 and yyparse. The %lex-param, %parse-param, and %param directives
10 support one or more arguments. Instead of
11
12 %lex-param {arg1_type *arg1}
13 %lex-param {arg2_type *arg2}
14 %parse-param {arg1_type *arg1}
15 %parse-param {arg2_type *arg2}
16
17 one may now declare
18
19 %param {arg1_type *arg1} {arg2_type *arg2}
20
21 ** Java skeleton improvements
22
23 The constants for token names were moved to the Lexer interface.
24 Also, it is possible to add code to the parser's constructors using
25 "%code init" and "%define init_throws".
26
27 ** C++ skeleton improvements
28
29 The C++ parser features a syntax_error exception, which can be
30 thrown from the scanner or from user rules to raise syntax errors.
31 This facilitates reporting errors caught in sub-functions (e.g.,
32 rejecting too large integral literals from a conversion function
33 used by the scanner, or rejecting invalid combinations from a
34 factory invoked by the user actions).
35
36 ** Variable api.tokens.prefix
37
38 The variable api.tokens.prefix changes the way tokens are identified in
39 the generated files. This is especially useful to avoid collisions
40 with identifiers in the target language. For instance
41
42 %token FILE for ERROR
43 %define api.tokens.prefix "TOK_"
44 %%
45 start: FILE for ERROR;
46
47 will generate the definition of the symbols TOK_FILE, TOK_for, and
48 TOK_ERROR in the generated sources. In particular, the scanner must
49 use these prefixed token names, although the grammar itself still
50 uses the short names (as in the sample rule given above).
51
52 ** Variable api.namespace
53
54 The "namespace" variable is renamed "api.namespace". Backward
55 compatibility is ensured, but upgrading is recommended.
56
57 ** Variable parse.error
58
59 The variable error controls the verbosity of error messages. The
60 use of the %error-verbose directive is deprecated in favor of
61 %define parse.error "verbose".
62
63 ** Semantic predicates
64
65 The new, experimental, semantic-predicate feature allows actions of
66 the form %?{ BOOLEAN-EXPRESSION }, which cause syntax errors (as for
67 YYERROR) if the expression evaluates to 0, and are evaluated immediately
68 in GLR parsers, rather than being deferred. The result is that they
69 allow the programmer to prune possible parses based on the values of
70 runtime expressions.
71
72 * Changes in version 2.5.1 (????-??-??):
73
74 ** Future changes:
75
76 The next major release will drop support for K&R C.
77
78 ** yacc.c: YYBACKUP works as expected.
79
80 ** glr.c improvements:
81
82 *** Location support is eliminated when not requested:
83
84 GLR parsers used to include location-related code even when
85 locations were not requested, and therefore not even usable.
86
87 *** __attribute__ is preserved:
88
89 __attribute__ is no longer disabled when __STRICT_ANSI__ is defined
90 (i.e., when -std is passed to GCC).
91
92 ** lalr1.java: several fixes:
93
94 The Java parser no longer throws ArrayIndexOutOfBoundsException if
95 the first token leads to a syntax error. Some minor clean ups.
96
97 ** C++11 compatibility:
98
99 C and C++ parsers use nullptr instead of 0 when __cplusplus is
100 201103L or higher.
101
102 ** C++ locations:
103
104 The position and location constructors (and their initialize
105 methods) accept new arguments for line and column. Several issues
106 in the documentation were fixed.
107
108 ** liby is no longer asking for "rpl_fprintf" on some platforms.
109
110 ** Changes in the manual:
111
112 *** %printer is documented
113
114 The %printer directive, supported since at least Bison 1.50, is
115 finally documented. The %mfcalc example is extended to demonstrate
116 its use of printer.
117
118 The C++ parsers now also support yyoutput (as an alias to
119 debug_stream ()) for consistency with the C skeletons.
120
121 *** Several improvements have been made:
122
123 The layout for grammar excerpts was changed to a more compact
124 scheme. Named references are motivated. The description of the
125 automaton description file (*.output) is updated to the current
126 format. Incorrect index entries were fixed. Some other errors were
127 fixed.
128
129 ** Changes to the build system:
130
131 *** Warnings during the build procedure have been eliminated.
132
133 *** Several portability problems in the test suite have been fixed:
134
135 This includes warnings with some compilers, unexpected behavior of
136 tools such as diff, warning messages from the test suite itself,
137 etc.
138
139 *** The install-pdf target work properly:
140
141 Running "make install-pdf" (or -dvi, -html, -info, and -ps) no
142 longer halts in the middle of its course.
143
144 * Changes in version 2.5 (2011-05-14):
145
146 ** Grammar symbol names can now contain non-initial dashes:
147
148 Consistently with directives (such as %error-verbose) and with
149 %define variables (e.g. push-pull), grammar symbol names may contain
150 dashes in any position except the beginning. This is a GNU
151 extension over POSIX Yacc. Thus, use of this extension is reported
152 by -Wyacc and rejected in Yacc mode (--yacc).
153
154 ** Named references:
155
156 Historically, Yacc and Bison have supported positional references
157 ($n, $$) to allow access to symbol values from inside of semantic
158 actions code.
159
160 Starting from this version, Bison can also accept named references.
161 When no ambiguity is possible, original symbol names may be used
162 as named references:
163
164 if_stmt : "if" cond_expr "then" then_stmt ';'
165 { $if_stmt = mk_if_stmt($cond_expr, $then_stmt); }
166
167 In the more common case, explicit names may be declared:
168
169 stmt[res] : "if" expr[cond] "then" stmt[then] "else" stmt[else] ';'
170 { $res = mk_if_stmt($cond, $then, $else); }
171
172 Location information is also accessible using @name syntax. When
173 accessing symbol names containing dots or dashes, explicit bracketing
174 ($[sym.1]) must be used.
175
176 These features are experimental in this version. More user feedback
177 will help to stabilize them.
178
179 ** IELR(1) and canonical LR(1):
180
181 IELR(1) is a minimal LR(1) parser table generation algorithm. That
182 is, given any context-free grammar, IELR(1) generates parser tables
183 with the full language-recognition power of canonical LR(1) but with
184 nearly the same number of parser states as LALR(1). This reduction
185 in parser states is often an order of magnitude. More importantly,
186 because canonical LR(1)'s extra parser states may contain duplicate
187 conflicts in the case of non-LR(1) grammars, the number of conflicts
188 for IELR(1) is often an order of magnitude less as well. This can
189 significantly reduce the complexity of developing of a grammar.
190
191 Bison can now generate IELR(1) and canonical LR(1) parser tables in
192 place of its traditional LALR(1) parser tables, which remain the
193 default. You can specify the type of parser tables in the grammar
194 file with these directives:
195
196 %define lr.type lalr
197 %define lr.type ielr
198 %define lr.type canonical-lr
199
200 The default-reduction optimization in the parser tables can also be
201 adjusted using `%define lr.default-reductions'. For details on both
202 of these features, see the new section `Tuning LR' in the Bison
203 manual.
204
205 These features are experimental. More user feedback will help to
206 stabilize them.
207
208 ** LAC (Lookahead Correction) for syntax error handling:
209
210 Canonical LR, IELR, and LALR can suffer from a couple of problems
211 upon encountering a syntax error. First, the parser might perform
212 additional parser stack reductions before discovering the syntax
213 error. Such reductions can perform user semantic actions that are
214 unexpected because they are based on an invalid token, and they
215 cause error recovery to begin in a different syntactic context than
216 the one in which the invalid token was encountered. Second, when
217 verbose error messages are enabled (with %error-verbose or the
218 obsolete `#define YYERROR_VERBOSE'), the expected token list in the
219 syntax error message can both contain invalid tokens and omit valid
220 tokens.
221
222 The culprits for the above problems are %nonassoc, default
223 reductions in inconsistent states, and parser state merging. Thus,
224 IELR and LALR suffer the most. Canonical LR can suffer only if
225 %nonassoc is used or if default reductions are enabled for
226 inconsistent states.
227
228 LAC is a new mechanism within the parsing algorithm that solves
229 these problems for canonical LR, IELR, and LALR without sacrificing
230 %nonassoc, default reductions, or state merging. When LAC is in
231 use, canonical LR and IELR behave almost exactly the same for both
232 syntactically acceptable and syntactically unacceptable input.
233 While LALR still does not support the full language-recognition
234 power of canonical LR and IELR, LAC at least enables LALR's syntax
235 error handling to correctly reflect LALR's language-recognition
236 power.
237
238 Currently, LAC is only supported for deterministic parsers in C.
239 You can enable LAC with the following directive:
240
241 %define parse.lac full
242
243 See the new section `LAC' in the Bison manual for additional
244 details including a few caveats.
245
246 LAC is an experimental feature. More user feedback will help to
247 stabilize it.
248
249 ** %define improvements:
250
251 *** Can now be invoked via the command line:
252
253 Each of these command-line options
254
255 -D NAME[=VALUE]
256 --define=NAME[=VALUE]
257
258 -F NAME[=VALUE]
259 --force-define=NAME[=VALUE]
260
261 is equivalent to this grammar file declaration
262
263 %define NAME ["VALUE"]
264
265 except that the manner in which Bison processes multiple definitions
266 for the same NAME differs. Most importantly, -F and --force-define
267 quietly override %define, but -D and --define do not. For further
268 details, see the section `Bison Options' in the Bison manual.
269
270 *** Variables renamed:
271
272 The following %define variables
273
274 api.push_pull
275 lr.keep_unreachable_states
276
277 have been renamed to
278
279 api.push-pull
280 lr.keep-unreachable-states
281
282 The old names are now deprecated but will be maintained indefinitely
283 for backward compatibility.
284
285 *** Values no longer need to be quoted in the grammar file:
286
287 If a %define value is an identifier, it no longer needs to be placed
288 within quotations marks. For example,
289
290 %define api.push-pull "push"
291
292 can be rewritten as
293
294 %define api.push-pull push
295
296 *** Unrecognized variables are now errors not warnings.
297
298 *** Multiple invocations for any variable is now an error not a warning.
299
300 ** Unrecognized %code qualifiers are now errors not warnings.
301
302 ** Character literals not of length one:
303
304 Previously, Bison quietly converted all character literals to length
305 one. For example, without warning, Bison interpreted the operators in
306 the following grammar to be the same token:
307
308 exp: exp '++'
309 | exp '+' exp
310 ;
311
312 Bison now warns when a character literal is not of length one. In
313 some future release, Bison will start reporting an error instead.
314
315 ** Destructor calls fixed for lookaheads altered in semantic actions:
316
317 Previously for deterministic parsers in C, if a user semantic action
318 altered yychar, the parser in some cases used the old yychar value to
319 determine which destructor to call for the lookahead upon a syntax
320 error or upon parser return. This bug has been fixed.
321
322 ** C++ parsers use YYRHSLOC:
323
324 Similarly to the C parsers, the C++ parsers now define the YYRHSLOC
325 macro and use it in the default YYLLOC_DEFAULT. You are encouraged
326 to use it. If, for instance, your location structure has `first'
327 and `last' members, instead of
328
329 # define YYLLOC_DEFAULT(Current, Rhs, N) \
330 do \
331 if (N) \
332 { \
333 (Current).first = (Rhs)[1].location.first; \
334 (Current).last = (Rhs)[N].location.last; \
335 } \
336 else \
337 { \
338 (Current).first = (Current).last = (Rhs)[0].location.last; \
339 } \
340 while (false)
341
342 use:
343
344 # define YYLLOC_DEFAULT(Current, Rhs, N) \
345 do \
346 if (N) \
347 { \
348 (Current).first = YYRHSLOC (Rhs, 1).first; \
349 (Current).last = YYRHSLOC (Rhs, N).last; \
350 } \
351 else \
352 { \
353 (Current).first = (Current).last = YYRHSLOC (Rhs, 0).last; \
354 } \
355 while (false)
356
357 ** YYLLOC_DEFAULT in C++:
358
359 The default implementation of YYLLOC_DEFAULT used to be issued in
360 the header file. It is now output in the implementation file, after
361 the user %code sections so that its #ifndef guard does not try to
362 override the user's YYLLOC_DEFAULT if provided.
363
364 ** YYFAIL now produces warnings and Java parsers no longer implement it:
365
366 YYFAIL has existed for many years as an undocumented feature of
367 deterministic parsers in C generated by Bison. More recently, it was
368 a documented feature of Bison's experimental Java parsers. As
369 promised in Bison 2.4.2's NEWS entry, any appearance of YYFAIL in a
370 semantic action now produces a deprecation warning, and Java parsers
371 no longer implement YYFAIL at all. For further details, including a
372 discussion of how to suppress C preprocessor warnings about YYFAIL
373 being unused, see the Bison 2.4.2 NEWS entry.
374
375 ** Temporary hack for adding a semicolon to the user action:
376
377 Previously, Bison appended a semicolon to every user action for
378 reductions when the output language defaulted to C (specifically, when
379 neither %yacc, %language, %skeleton, or equivalent command-line
380 options were specified). This allowed actions such as
381
382 exp: exp "+" exp { $$ = $1 + $3 };
383
384 instead of
385
386 exp: exp "+" exp { $$ = $1 + $3; };
387
388 As a first step in removing this misfeature, Bison now issues a
389 warning when it appends a semicolon. Moreover, in cases where Bison
390 cannot easily determine whether a semicolon is needed (for example, an
391 action ending with a cpp directive or a braced compound initializer),
392 it no longer appends one. Thus, the C compiler might now complain
393 about a missing semicolon where it did not before. Future releases of
394 Bison will cease to append semicolons entirely.
395
396 ** Verbose syntax error message fixes:
397
398 When %error-verbose or the obsolete `#define YYERROR_VERBOSE' is
399 specified, syntax error messages produced by the generated parser
400 include the unexpected token as well as a list of expected tokens.
401 The effect of %nonassoc on these verbose messages has been corrected
402 in two ways, but a more complete fix requires LAC, described above:
403
404 *** When %nonassoc is used, there can exist parser states that accept no
405 tokens, and so the parser does not always require a lookahead token
406 in order to detect a syntax error. Because no unexpected token or
407 expected tokens can then be reported, the verbose syntax error
408 message described above is suppressed, and the parser instead
409 reports the simpler message, `syntax error'. Previously, this
410 suppression was sometimes erroneously triggered by %nonassoc when a
411 lookahead was actually required. Now verbose messages are
412 suppressed only when all previous lookaheads have already been
413 shifted or discarded.
414
415 *** Previously, the list of expected tokens erroneously included tokens
416 that would actually induce a syntax error because conflicts for them
417 were resolved with %nonassoc in the current parser state. Such
418 tokens are now properly omitted from the list.
419
420 *** Expected token lists are still often wrong due to state merging
421 (from LALR or IELR) and default reductions, which can both add
422 invalid tokens and subtract valid tokens. Canonical LR almost
423 completely fixes this problem by eliminating state merging and
424 default reductions. However, there is one minor problem left even
425 when using canonical LR and even after the fixes above. That is,
426 if the resolution of a conflict with %nonassoc appears in a later
427 parser state than the one at which some syntax error is
428 discovered, the conflicted token is still erroneously included in
429 the expected token list. Bison's new LAC implementation,
430 described above, eliminates this problem and the need for
431 canonical LR. However, LAC is still experimental and is disabled
432 by default.
433
434 ** Java skeleton fixes:
435
436 *** A location handling bug has been fixed.
437
438 *** The top element of each of the value stack and location stack is now
439 cleared when popped so that it can be garbage collected.
440
441 *** Parser traces now print the top element of the stack.
442
443 ** -W/--warnings fixes:
444
445 *** Bison now properly recognizes the `no-' versions of categories:
446
447 For example, given the following command line, Bison now enables all
448 warnings except warnings for incompatibilities with POSIX Yacc:
449
450 bison -Wall,no-yacc gram.y
451
452 *** Bison now treats S/R and R/R conflicts like other warnings:
453
454 Previously, conflict reports were independent of Bison's normal
455 warning system. Now, Bison recognizes the warning categories
456 `conflicts-sr' and `conflicts-rr'. This change has important
457 consequences for the -W and --warnings command-line options. For
458 example:
459
460 bison -Wno-conflicts-sr gram.y # S/R conflicts not reported
461 bison -Wno-conflicts-rr gram.y # R/R conflicts not reported
462 bison -Wnone gram.y # no conflicts are reported
463 bison -Werror gram.y # any conflict is an error
464
465 However, as before, if the %expect or %expect-rr directive is
466 specified, an unexpected number of conflicts is an error, and an
467 expected number of conflicts is not reported, so -W and --warning
468 then have no effect on the conflict report.
469
470 *** The `none' category no longer disables a preceding `error':
471
472 For example, for the following command line, Bison now reports
473 errors instead of warnings for incompatibilities with POSIX Yacc:
474
475 bison -Werror,none,yacc gram.y
476
477 *** The `none' category now disables all Bison warnings:
478
479 Previously, the `none' category disabled only Bison warnings for
480 which there existed a specific -W/--warning category. However,
481 given the following command line, Bison is now guaranteed to
482 suppress all warnings:
483
484 bison -Wnone gram.y
485
486 ** Precedence directives can now assign token number 0:
487
488 Since Bison 2.3b, which restored the ability of precedence
489 directives to assign token numbers, doing so for token number 0 has
490 produced an assertion failure. For example:
491
492 %left END 0
493
494 This bug has been fixed.
495
496 * Changes in version 2.4.3 (2010-08-05):
497
498 ** Bison now obeys -Werror and --warnings=error for warnings about
499 grammar rules that are useless in the parser due to conflicts.
500
501 ** Problems with spawning M4 on at least FreeBSD 8 and FreeBSD 9 have
502 been fixed.
503
504 ** Failures in the test suite for GCC 4.5 have been fixed.
505
506 ** Failures in the test suite for some versions of Sun Studio C++ have
507 been fixed.
508
509 ** Contrary to Bison 2.4.2's NEWS entry, it has been decided that
510 warnings about undefined %prec identifiers will not be converted to
511 errors in Bison 2.5. They will remain warnings, which should be
512 sufficient for POSIX while avoiding backward compatibility issues.
513
514 ** Minor documentation fixes.
515
516 * Changes in version 2.4.2 (2010-03-20):
517
518 ** Some portability problems that resulted in failures and livelocks
519 in the test suite on some versions of at least Solaris, AIX, HP-UX,
520 RHEL4, and Tru64 have been addressed. As a result, fatal Bison
521 errors should no longer cause M4 to report a broken pipe on the
522 affected platforms.
523
524 ** `%prec IDENTIFIER' requires IDENTIFIER to be defined separately.
525
526 POSIX specifies that an error be reported for any identifier that does
527 not appear on the LHS of a grammar rule and that is not defined by
528 %token, %left, %right, or %nonassoc. Bison 2.3b and later lost this
529 error report for the case when an identifier appears only after a
530 %prec directive. It is now restored. However, for backward
531 compatibility with recent Bison releases, it is only a warning for
532 now. In Bison 2.5 and later, it will return to being an error.
533 [Between the 2.4.2 and 2.4.3 releases, it was decided that this
534 warning will not be converted to an error in Bison 2.5.]
535
536 ** Detection of GNU M4 1.4.6 or newer during configure is improved.
537
538 ** Warnings from gcc's -Wundef option about undefined YYENABLE_NLS,
539 YYLTYPE_IS_TRIVIAL, and __STRICT_ANSI__ in C/C++ parsers are now
540 avoided.
541
542 ** %code is now a permanent feature.
543
544 A traditional Yacc prologue directive is written in the form:
545
546 %{CODE%}
547
548 To provide a more flexible alternative, Bison 2.3b introduced the
549 %code directive with the following forms for C/C++:
550
551 %code {CODE}
552 %code requires {CODE}
553 %code provides {CODE}
554 %code top {CODE}
555
556 These forms are now considered permanent features of Bison. See the
557 %code entries in the section "Bison Declaration Summary" in the Bison
558 manual for a summary of their functionality. See the section
559 "Prologue Alternatives" for a detailed discussion including the
560 advantages of %code over the traditional Yacc prologue directive.
561
562 Bison's Java feature as a whole including its current usage of %code
563 is still considered experimental.
564
565 ** YYFAIL is deprecated and will eventually be removed.
566
567 YYFAIL has existed for many years as an undocumented feature of
568 deterministic parsers in C generated by Bison. Previously, it was
569 documented for Bison's experimental Java parsers. YYFAIL is no longer
570 documented for Java parsers and is formally deprecated in both cases.
571 Users are strongly encouraged to migrate to YYERROR, which is
572 specified by POSIX.
573
574 Like YYERROR, you can invoke YYFAIL from a semantic action in order to
575 induce a syntax error. The most obvious difference from YYERROR is
576 that YYFAIL will automatically invoke yyerror to report the syntax
577 error so that you don't have to. However, there are several other
578 subtle differences between YYERROR and YYFAIL, and YYFAIL suffers from
579 inherent flaws when %error-verbose or `#define YYERROR_VERBOSE' is
580 used. For a more detailed discussion, see:
581
582 http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html
583
584 The upcoming Bison 2.5 will remove YYFAIL from Java parsers, but
585 deterministic parsers in C will continue to implement it. However,
586 because YYFAIL is already flawed, it seems futile to try to make new
587 Bison features compatible with it. Thus, during parser generation,
588 Bison 2.5 will produce a warning whenever it discovers YYFAIL in a
589 rule action. In a later release, YYFAIL will be disabled for
590 %error-verbose and `#define YYERROR_VERBOSE'. Eventually, YYFAIL will
591 be removed altogether.
592
593 There exists at least one case where Bison 2.5's YYFAIL warning will
594 be a false positive. Some projects add phony uses of YYFAIL and other
595 Bison-defined macros for the sole purpose of suppressing C
596 preprocessor warnings (from GCC cpp's -Wunused-macros, for example).
597 To avoid Bison's future warning, such YYFAIL uses can be moved to the
598 epilogue (that is, after the second `%%') in the Bison input file. In
599 this release (2.4.2), Bison already generates its own code to suppress
600 C preprocessor warnings for YYFAIL, so projects can remove their own
601 phony uses of YYFAIL if compatibility with Bison releases prior to
602 2.4.2 is not necessary.
603
604 ** Internationalization.
605
606 Fix a regression introduced in Bison 2.4: Under some circumstances,
607 message translations were not installed although supported by the
608 host system.
609
610 * Changes in version 2.4.1 (2008-12-11):
611
612 ** In the GLR defines file, unexpanded M4 macros in the yylval and yylloc
613 declarations have been fixed.
614
615 ** Temporary hack for adding a semicolon to the user action.
616
617 Bison used to prepend a trailing semicolon at the end of the user
618 action for reductions. This allowed actions such as
619
620 exp: exp "+" exp { $$ = $1 + $3 };
621
622 instead of
623
624 exp: exp "+" exp { $$ = $1 + $3; };
625
626 Some grammars still depend on this `feature'. Bison 2.4.1 restores
627 the previous behavior in the case of C output (specifically, when
628 neither %language or %skeleton or equivalent command-line options
629 are used) to leave more time for grammars depending on the old
630 behavior to be adjusted. Future releases of Bison will disable this
631 feature.
632
633 ** A few minor improvements to the Bison manual.
634
635 * Changes in version 2.4 (2008-11-02):
636
637 ** %language is an experimental feature.
638
639 We first introduced this feature in test release 2.3b as a cleaner
640 alternative to %skeleton. Since then, we have discussed the possibility of
641 modifying its effect on Bison's output file names. Thus, in this release,
642 we consider %language to be an experimental feature that will likely evolve
643 in future releases.
644
645 ** Forward compatibility with GNU M4 has been improved.
646
647 ** Several bugs in the C++ skeleton and the experimental Java skeleton have been
648 fixed.
649
650 * Changes in version 2.3b (2008-05-27):
651
652 ** The quotes around NAME that used to be required in the following directive
653 are now deprecated:
654
655 %define NAME "VALUE"
656
657 ** The directive `%pure-parser' is now deprecated in favor of:
658
659 %define api.pure
660
661 which has the same effect except that Bison is more careful to warn about
662 unreasonable usage in the latter case.
663
664 ** Push Parsing
665
666 Bison can now generate an LALR(1) parser in C with a push interface. That
667 is, instead of invoking `yyparse', which pulls tokens from `yylex', you can
668 push one token at a time to the parser using `yypush_parse', which will
669 return to the caller after processing each token. By default, the push
670 interface is disabled. Either of the following directives will enable it:
671
672 %define api.push_pull "push" // Just push; does not require yylex.
673 %define api.push_pull "both" // Push and pull; requires yylex.
674
675 See the new section `A Push Parser' in the Bison manual for details.
676
677 The current push parsing interface is experimental and may evolve. More user
678 feedback will help to stabilize it.
679
680 ** The -g and --graph options now output graphs in Graphviz DOT format,
681 not VCG format. Like --graph, -g now also takes an optional FILE argument
682 and thus cannot be bundled with other short options.
683
684 ** Java
685
686 Bison can now generate an LALR(1) parser in Java. The skeleton is
687 `data/lalr1.java'. Consider using the new %language directive instead of
688 %skeleton to select it.
689
690 See the new section `Java Parsers' in the Bison manual for details.
691
692 The current Java interface is experimental and may evolve. More user
693 feedback will help to stabilize it.
694
695 ** %language
696
697 This new directive specifies the programming language of the generated
698 parser, which can be C (the default), C++, or Java. Besides the skeleton
699 that Bison uses, the directive affects the names of the generated files if
700 the grammar file's name ends in ".y".
701
702 ** XML Automaton Report
703
704 Bison can now generate an XML report of the LALR(1) automaton using the new
705 `--xml' option. The current XML schema is experimental and may evolve. More
706 user feedback will help to stabilize it.
707
708 ** The grammar file may now specify the name of the parser header file using
709 %defines. For example:
710
711 %defines "parser.h"
712
713 ** When reporting useless rules, useless nonterminals, and unused terminals,
714 Bison now employs the terms "useless in grammar" instead of "useless",
715 "useless in parser" instead of "never reduced", and "unused in grammar"
716 instead of "unused".
717
718 ** Unreachable State Removal
719
720 Previously, Bison sometimes generated parser tables containing unreachable
721 states. A state can become unreachable during conflict resolution if Bison
722 disables a shift action leading to it from a predecessor state. Bison now:
723
724 1. Removes unreachable states.
725
726 2. Does not report any conflicts that appeared in unreachable states.
727 WARNING: As a result, you may need to update %expect and %expect-rr
728 directives in existing grammar files.
729
730 3. For any rule used only in such states, Bison now reports the rule as
731 "useless in parser due to conflicts".
732
733 This feature can be disabled with the following directive:
734
735 %define lr.keep_unreachable_states
736
737 See the %define entry in the `Bison Declaration Summary' in the Bison manual
738 for further discussion.
739
740 ** Lookahead Set Correction in the `.output' Report
741
742 When instructed to generate a `.output' file including lookahead sets
743 (using `--report=lookahead', for example), Bison now prints each reduction's
744 lookahead set only next to the associated state's one item that (1) is
745 associated with the same rule as the reduction and (2) has its dot at the end
746 of its RHS. Previously, Bison also erroneously printed the lookahead set
747 next to all of the state's other items associated with the same rule. This
748 bug affected only the `.output' file and not the generated parser source
749 code.
750
751 ** --report-file=FILE is a new option to override the default `.output' file
752 name.
753
754 ** The `=' that used to be required in the following directives is now
755 deprecated:
756
757 %file-prefix "parser"
758 %name-prefix "c_"
759 %output "parser.c"
760
761 ** An Alternative to `%{...%}' -- `%code QUALIFIER {CODE}'
762
763 Bison 2.3a provided a new set of directives as a more flexible alternative to
764 the traditional Yacc prologue blocks. Those have now been consolidated into
765 a single %code directive with an optional qualifier field, which identifies
766 the purpose of the code and thus the location(s) where Bison should generate
767 it:
768
769 1. `%code {CODE}' replaces `%after-header {CODE}'
770 2. `%code requires {CODE}' replaces `%start-header {CODE}'
771 3. `%code provides {CODE}' replaces `%end-header {CODE}'
772 4. `%code top {CODE}' replaces `%before-header {CODE}'
773
774 See the %code entries in section `Bison Declaration Summary' in the Bison
775 manual for a summary of the new functionality. See the new section `Prologue
776 Alternatives' for a detailed discussion including the advantages of %code
777 over the traditional Yacc prologues.
778
779 The prologue alternatives are experimental. More user feedback will help to
780 determine whether they should become permanent features.
781
782 ** Revised warning: unset or unused mid-rule values
783
784 Since Bison 2.2, Bison has warned about mid-rule values that are set but not
785 used within any of the actions of the parent rule. For example, Bison warns
786 about unused $2 in:
787
788 exp: '1' { $$ = 1; } '+' exp { $$ = $1 + $4; };
789
790 Now, Bison also warns about mid-rule values that are used but not set. For
791 example, Bison warns about unset $$ in the mid-rule action in:
792
793 exp: '1' { $1 = 1; } '+' exp { $$ = $2 + $4; };
794
795 However, Bison now disables both of these warnings by default since they
796 sometimes prove to be false alarms in existing grammars employing the Yacc
797 constructs $0 or $-N (where N is some positive integer).
798
799 To enable these warnings, specify the option `--warnings=midrule-values' or
800 `-W', which is a synonym for `--warnings=all'.
801
802 ** Default %destructor or %printer with `<*>' or `<>'
803
804 Bison now recognizes two separate kinds of default %destructor's and
805 %printer's:
806
807 1. Place `<*>' in a %destructor/%printer symbol list to define a default
808 %destructor/%printer for all grammar symbols for which you have formally
809 declared semantic type tags.
810
811 2. Place `<>' in a %destructor/%printer symbol list to define a default
812 %destructor/%printer for all grammar symbols without declared semantic
813 type tags.
814
815 Bison no longer supports the `%symbol-default' notation from Bison 2.3a.
816 `<*>' and `<>' combined achieve the same effect with one exception: Bison no
817 longer applies any %destructor to a mid-rule value if that mid-rule value is
818 not actually ever referenced using either $$ or $n in a semantic action.
819
820 The default %destructor's and %printer's are experimental. More user
821 feedback will help to determine whether they should become permanent
822 features.
823
824 See the section `Freeing Discarded Symbols' in the Bison manual for further
825 details.
826
827 ** %left, %right, and %nonassoc can now declare token numbers. This is required
828 by POSIX. However, see the end of section `Operator Precedence' in the Bison
829 manual for a caveat concerning the treatment of literal strings.
830
831 ** The nonfunctional --no-parser, -n, and %no-parser options have been
832 completely removed from Bison.
833
834 * Changes in version 2.3a, 2006-09-13:
835
836 ** Instead of %union, you can define and use your own union type
837 YYSTYPE if your grammar contains at least one <type> tag.
838 Your YYSTYPE need not be a macro; it can be a typedef.
839 This change is for compatibility with other Yacc implementations,
840 and is required by POSIX.
841
842 ** Locations columns and lines start at 1.
843 In accordance with the GNU Coding Standards and Emacs.
844
845 ** You may now declare per-type and default %destructor's and %printer's:
846
847 For example:
848
849 %union { char *string; }
850 %token <string> STRING1
851 %token <string> STRING2
852 %type <string> string1
853 %type <string> string2
854 %union { char character; }
855 %token <character> CHR
856 %type <character> chr
857 %destructor { free ($$); } %symbol-default
858 %destructor { free ($$); printf ("%d", @$.first_line); } STRING1 string1
859 %destructor { } <character>
860
861 guarantees that, when the parser discards any user-defined symbol that has a
862 semantic type tag other than `<character>', it passes its semantic value to
863 `free'. However, when the parser discards a `STRING1' or a `string1', it
864 also prints its line number to `stdout'. It performs only the second
865 `%destructor' in this case, so it invokes `free' only once.
866
867 [Although we failed to mention this here in the 2.3a release, the default
868 %destructor's and %printer's were experimental, and they were rewritten in
869 future versions.]
870
871 ** Except for LALR(1) parsers in C with POSIX Yacc emulation enabled (with `-y',
872 `--yacc', or `%yacc'), Bison no longer generates #define statements for
873 associating token numbers with token names. Removing the #define statements
874 helps to sanitize the global namespace during preprocessing, but POSIX Yacc
875 requires them. Bison still generates an enum for token names in all cases.
876
877 ** Handling of traditional Yacc prologue blocks is now more consistent but
878 potentially incompatible with previous releases of Bison.
879
880 As before, you declare prologue blocks in your grammar file with the
881 `%{ ... %}' syntax. To generate the pre-prologue, Bison concatenates all
882 prologue blocks that you've declared before the first %union. To generate
883 the post-prologue, Bison concatenates all prologue blocks that you've
884 declared after the first %union.
885
886 Previous releases of Bison inserted the pre-prologue into both the header
887 file and the code file in all cases except for LALR(1) parsers in C. In the
888 latter case, Bison inserted it only into the code file. For parsers in C++,
889 the point of insertion was before any token definitions (which associate
890 token numbers with names). For parsers in C, the point of insertion was
891 after the token definitions.
892
893 Now, Bison never inserts the pre-prologue into the header file. In the code
894 file, it always inserts it before the token definitions.
895
896 ** Bison now provides a more flexible alternative to the traditional Yacc
897 prologue blocks: %before-header, %start-header, %end-header, and
898 %after-header.
899
900 For example, the following declaration order in the grammar file reflects the
901 order in which Bison will output these code blocks. However, you are free to
902 declare these code blocks in your grammar file in whatever order is most
903 convenient for you:
904
905 %before-header {
906 /* Bison treats this block like a pre-prologue block: it inserts it into
907 * the code file before the contents of the header file. It does *not*
908 * insert it into the header file. This is a good place to put
909 * #include's that you want at the top of your code file. A common
910 * example is `#include "system.h"'. */
911 }
912 %start-header {
913 /* Bison inserts this block into both the header file and the code file.
914 * In both files, the point of insertion is before any Bison-generated
915 * token, semantic type, location type, and class definitions. This is a
916 * good place to define %union dependencies, for example. */
917 }
918 %union {
919 /* Unlike the traditional Yacc prologue blocks, the output order for the
920 * new %*-header blocks is not affected by their declaration position
921 * relative to any %union in the grammar file. */
922 }
923 %end-header {
924 /* Bison inserts this block into both the header file and the code file.
925 * In both files, the point of insertion is after the Bison-generated
926 * definitions. This is a good place to declare or define public
927 * functions or data structures that depend on the Bison-generated
928 * definitions. */
929 }
930 %after-header {
931 /* Bison treats this block like a post-prologue block: it inserts it into
932 * the code file after the contents of the header file. It does *not*
933 * insert it into the header file. This is a good place to declare or
934 * define internal functions or data structures that depend on the
935 * Bison-generated definitions. */
936 }
937
938 If you have multiple occurrences of any one of the above declarations, Bison
939 will concatenate the contents in declaration order.
940
941 [Although we failed to mention this here in the 2.3a release, the prologue
942 alternatives were experimental, and they were rewritten in future versions.]
943
944 ** The option `--report=look-ahead' has been changed to `--report=lookahead'.
945 The old spelling still works, but is not documented and may be removed
946 in a future release.
947
948 * Changes in version 2.3, 2006-06-05:
949
950 ** GLR grammars should now use `YYRECOVERING ()' instead of `YYRECOVERING',
951 for compatibility with LALR(1) grammars.
952
953 ** It is now documented that any definition of YYSTYPE or YYLTYPE should
954 be to a type name that does not contain parentheses or brackets.
955
956 * Changes in version 2.2, 2006-05-19:
957
958 ** The distribution terms for all Bison-generated parsers now permit
959 using the parsers in nonfree programs. Previously, this permission
960 was granted only for Bison-generated LALR(1) parsers in C.
961
962 ** %name-prefix changes the namespace name in C++ outputs.
963
964 ** The C++ parsers export their token_type.
965
966 ** Bison now allows multiple %union declarations, and concatenates
967 their contents together.
968
969 ** New warning: unused values
970 Right-hand side symbols whose values are not used are reported,
971 if the symbols have destructors. For instance:
972
973 exp: exp "?" exp ":" exp { $1 ? $1 : $3; }
974 | exp "+" exp
975 ;
976
977 will trigger a warning about $$ and $5 in the first rule, and $3 in
978 the second ($1 is copied to $$ by the default rule). This example
979 most likely contains three errors, and could be rewritten as:
980
981 exp: exp "?" exp ":" exp
982 { $$ = $1 ? $3 : $5; free ($1 ? $5 : $3); free ($1); }
983 | exp "+" exp
984 { $$ = $1 ? $1 : $3; if ($1) free ($3); }
985 ;
986
987 However, if the original actions were really intended, memory leaks
988 and all, the warnings can be suppressed by letting Bison believe the
989 values are used, e.g.:
990
991 exp: exp "?" exp ":" exp { $1 ? $1 : $3; (void) ($$, $5); }
992 | exp "+" exp { $$ = $1; (void) $3; }
993 ;
994
995 If there are mid-rule actions, the warning is issued if no action
996 uses it. The following triggers no warning: $1 and $3 are used.
997
998 exp: exp { push ($1); } '+' exp { push ($3); sum (); };
999
1000 The warning is intended to help catching lost values and memory leaks.
1001 If a value is ignored, its associated memory typically is not reclaimed.
1002
1003 ** %destructor vs. YYABORT, YYACCEPT, and YYERROR.
1004 Destructors are now called when user code invokes YYABORT, YYACCEPT,
1005 and YYERROR, for all objects on the stack, other than objects
1006 corresponding to the right-hand side of the current rule.
1007
1008 ** %expect, %expect-rr
1009 Incorrect numbers of expected conflicts are now actual errors,
1010 instead of warnings.
1011
1012 ** GLR, YACC parsers.
1013 The %parse-params are available in the destructors (and the
1014 experimental printers) as per the documentation.
1015
1016 ** Bison now warns if it finds a stray `$' or `@' in an action.
1017
1018 ** %require "VERSION"
1019 This specifies that the grammar file depends on features implemented
1020 in Bison version VERSION or higher.
1021
1022 ** lalr1.cc: The token and value types are now class members.
1023 The tokens were defined as free form enums and cpp macros. YYSTYPE
1024 was defined as a free form union. They are now class members:
1025 tokens are enumerations of the `yy::parser::token' struct, and the
1026 semantic values have the `yy::parser::semantic_type' type.
1027
1028 If you do not want or can update to this scheme, the directive
1029 `%define "global_tokens_and_yystype" "1"' triggers the global
1030 definition of tokens and YYSTYPE. This change is suitable both
1031 for previous releases of Bison, and this one.
1032
1033 If you wish to update, then make sure older version of Bison will
1034 fail using `%require "2.2"'.
1035
1036 ** DJGPP support added.
1037 \f
1038 * Changes in version 2.1, 2005-09-16:
1039
1040 ** The C++ lalr1.cc skeleton supports %lex-param.
1041
1042 ** Bison-generated parsers now support the translation of diagnostics like
1043 "syntax error" into languages other than English. The default
1044 language is still English. For details, please see the new
1045 Internationalization section of the Bison manual. Software
1046 distributors should also see the new PACKAGING file. Thanks to
1047 Bruno Haible for this new feature.
1048
1049 ** Wording in the Bison-generated parsers has been changed slightly to
1050 simplify translation. In particular, the message "memory exhausted"
1051 has replaced "parser stack overflow", as the old message was not
1052 always accurate for modern Bison-generated parsers.
1053
1054 ** Destructors are now called when the parser aborts, for all symbols left
1055 behind on the stack. Also, the start symbol is now destroyed after a
1056 successful parse. In both cases, the behavior was formerly inconsistent.
1057
1058 ** When generating verbose diagnostics, Bison-generated parsers no longer
1059 quote the literal strings associated with tokens. For example, for
1060 a syntax error associated with '%token NUM "number"' they might
1061 print 'syntax error, unexpected number' instead of 'syntax error,
1062 unexpected "number"'.
1063 \f
1064 * Changes in version 2.0, 2004-12-25:
1065
1066 ** Possibly-incompatible changes
1067
1068 - Bison-generated parsers no longer default to using the alloca function
1069 (when available) to extend the parser stack, due to widespread
1070 problems in unchecked stack-overflow detection. You can "#define
1071 YYSTACK_USE_ALLOCA 1" to require the use of alloca, but please read
1072 the manual to determine safe values for YYMAXDEPTH in that case.
1073
1074 - Error token location.
1075 During error recovery, the location of the syntax error is updated
1076 to cover the whole sequence covered by the error token: it includes
1077 the shifted symbols thrown away during the first part of the error
1078 recovery, and the lookahead rejected during the second part.
1079
1080 - Semicolon changes:
1081 . Stray semicolons are no longer allowed at the start of a grammar.
1082 . Semicolons are now required after in-grammar declarations.
1083
1084 - Unescaped newlines are no longer allowed in character constants or
1085 string literals. They were never portable, and GCC 3.4.0 has
1086 dropped support for them. Better diagnostics are now generated if
1087 forget a closing quote.
1088
1089 - NUL bytes are no longer allowed in Bison string literals, unfortunately.
1090
1091 ** New features
1092
1093 - GLR grammars now support locations.
1094
1095 - New directive: %initial-action.
1096 This directive allows the user to run arbitrary code (including
1097 initializing @$) from yyparse before parsing starts.
1098
1099 - A new directive "%expect-rr N" specifies the expected number of
1100 reduce/reduce conflicts in GLR parsers.
1101
1102 - %token numbers can now be hexadecimal integers, e.g., `%token FOO 0x12d'.
1103 This is a GNU extension.
1104
1105 - The option `--report=lookahead' was changed to `--report=look-ahead'.
1106 [However, this was changed back after 2.3.]
1107
1108 - Experimental %destructor support has been added to lalr1.cc.
1109
1110 - New configure option --disable-yacc, to disable installation of the
1111 yacc command and -ly library introduced in 1.875 for POSIX conformance.
1112
1113 ** Bug fixes
1114
1115 - For now, %expect-count violations are now just warnings, not errors.
1116 This is for compatibility with Bison 1.75 and earlier (when there are
1117 reduce/reduce conflicts) and with Bison 1.30 and earlier (when there
1118 are too many or too few shift/reduce conflicts). However, in future
1119 versions of Bison we plan to improve the %expect machinery so that
1120 these violations will become errors again.
1121
1122 - Within Bison itself, numbers (e.g., goto numbers) are no longer
1123 arbitrarily limited to 16-bit counts.
1124
1125 - Semicolons are now allowed before "|" in grammar rules, as POSIX requires.
1126 \f
1127 * Changes in version 1.875, 2003-01-01:
1128
1129 ** The documentation license has been upgraded to version 1.2
1130 of the GNU Free Documentation License.
1131
1132 ** syntax error processing
1133
1134 - In Yacc-style parsers YYLLOC_DEFAULT is now used to compute error
1135 locations too. This fixes bugs in error-location computation.
1136
1137 - %destructor
1138 It is now possible to reclaim the memory associated to symbols
1139 discarded during error recovery. This feature is still experimental.
1140
1141 - %error-verbose
1142 This new directive is preferred over YYERROR_VERBOSE.
1143
1144 - #defining yyerror to steal internal variables is discouraged.
1145 It is not guaranteed to work forever.
1146
1147 ** POSIX conformance
1148
1149 - Semicolons are once again optional at the end of grammar rules.
1150 This reverts to the behavior of Bison 1.33 and earlier, and improves
1151 compatibility with Yacc.
1152
1153 - `parse error' -> `syntax error'
1154 Bison now uniformly uses the term `syntax error'; formerly, the code
1155 and manual sometimes used the term `parse error' instead. POSIX
1156 requires `syntax error' in diagnostics, and it was thought better to
1157 be consistent.
1158
1159 - The documentation now emphasizes that yylex and yyerror must be
1160 declared before use. C99 requires this.
1161
1162 - Bison now parses C99 lexical constructs like UCNs and
1163 backslash-newline within C escape sequences, as POSIX 1003.1-2001 requires.
1164
1165 - File names are properly escaped in C output. E.g., foo\bar.y is
1166 output as "foo\\bar.y".
1167
1168 - Yacc command and library now available
1169 The Bison distribution now installs a `yacc' command, as POSIX requires.
1170 Also, Bison now installs a small library liby.a containing
1171 implementations of Yacc-compatible yyerror and main functions.
1172 This library is normally not useful, but POSIX requires it.
1173
1174 - Type clashes now generate warnings, not errors.
1175
1176 - If the user does not define YYSTYPE as a macro, Bison now declares it
1177 using typedef instead of defining it as a macro.
1178 For consistency, YYLTYPE is also declared instead of defined.
1179
1180 ** Other compatibility issues
1181
1182 - %union directives can now have a tag before the `{', e.g., the
1183 directive `%union foo {...}' now generates the C code
1184 `typedef union foo { ... } YYSTYPE;'; this is for Yacc compatibility.
1185 The default union tag is `YYSTYPE', for compatibility with Solaris 9 Yacc.
1186 For consistency, YYLTYPE's struct tag is now `YYLTYPE' not `yyltype'.
1187 This is for compatibility with both Yacc and Bison 1.35.
1188
1189 - `;' is output before the terminating `}' of an action, for
1190 compatibility with Bison 1.35.
1191
1192 - Bison now uses a Yacc-style format for conflict reports, e.g.,
1193 `conflicts: 2 shift/reduce, 1 reduce/reduce'.
1194
1195 - `yystype' and `yyltype' are now obsolescent macros instead of being
1196 typedefs or tags; they are no longer documented and are planned to be
1197 withdrawn in a future release.
1198
1199 ** GLR parser notes
1200
1201 - GLR and inline
1202 Users of Bison have to decide how they handle the portability of the
1203 C keyword `inline'.
1204
1205 - `parsing stack overflow...' -> `parser stack overflow'
1206 GLR parsers now report `parser stack overflow' as per the Bison manual.
1207
1208 ** Bison now warns if it detects conflicting outputs to the same file,
1209 e.g., it generates a warning for `bison -d -o foo.h foo.y' since
1210 that command outputs both code and header to foo.h.
1211
1212 ** #line in output files
1213 - --no-line works properly.
1214
1215 ** Bison can no longer be built by a K&R C compiler; it requires C89 or
1216 later to be built. This change originally took place a few versions
1217 ago, but nobody noticed until we recently asked someone to try
1218 building Bison with a K&R C compiler.
1219 \f
1220 * Changes in version 1.75, 2002-10-14:
1221
1222 ** Bison should now work on 64-bit hosts.
1223
1224 ** Indonesian translation thanks to Tedi Heriyanto.
1225
1226 ** GLR parsers
1227 Fix spurious parse errors.
1228
1229 ** Pure parsers
1230 Some people redefine yyerror to steal yyparse' private variables.
1231 Reenable this trick until an official feature replaces it.
1232
1233 ** Type Clashes
1234 In agreement with POSIX and with other Yaccs, leaving a default
1235 action is valid when $$ is untyped, and $1 typed:
1236
1237 untyped: ... typed;
1238
1239 but the converse remains an error:
1240
1241 typed: ... untyped;
1242
1243 ** Values of mid-rule actions
1244 The following code:
1245
1246 foo: { ... } { $$ = $1; } ...
1247
1248 was incorrectly rejected: $1 is defined in the second mid-rule
1249 action, and is equal to the $$ of the first mid-rule action.
1250 \f
1251 * Changes in version 1.50, 2002-10-04:
1252
1253 ** GLR parsing
1254 The declaration
1255 %glr-parser
1256 causes Bison to produce a Generalized LR (GLR) parser, capable of handling
1257 almost any context-free grammar, ambiguous or not. The new declarations
1258 %dprec and %merge on grammar rules allow parse-time resolution of
1259 ambiguities. Contributed by Paul Hilfinger.
1260
1261 Unfortunately Bison 1.50 does not work properly on 64-bit hosts
1262 like the Alpha, so please stick to 32-bit hosts for now.
1263
1264 ** Output Directory
1265 When not in Yacc compatibility mode, when the output file was not
1266 specified, running `bison foo/bar.y' created `foo/bar.c'. It
1267 now creates `bar.c'.
1268
1269 ** Undefined token
1270 The undefined token was systematically mapped to 2 which prevented
1271 the use of 2 by the user. This is no longer the case.
1272
1273 ** Unknown token numbers
1274 If yylex returned an out of range value, yyparse could die. This is
1275 no longer the case.
1276
1277 ** Error token
1278 According to POSIX, the error token must be 256.
1279 Bison extends this requirement by making it a preference: *if* the
1280 user specified that one of her tokens is numbered 256, then error
1281 will be mapped onto another number.
1282
1283 ** Verbose error messages
1284 They no longer report `..., expecting error or...' for states where
1285 error recovery is possible.
1286
1287 ** End token
1288 Defaults to `$end' instead of `$'.
1289
1290 ** Error recovery now conforms to documentation and to POSIX
1291 When a Bison-generated parser encounters a syntax error, it now pops
1292 the stack until it finds a state that allows shifting the error
1293 token. Formerly, it popped the stack until it found a state that
1294 allowed some non-error action other than a default reduction on the
1295 error token. The new behavior has long been the documented behavior,
1296 and has long been required by POSIX. For more details, please see
1297 Paul Eggert, "Reductions during Bison error handling" (2002-05-20)
1298 <http://lists.gnu.org/archive/html/bug-bison/2002-05/msg00038.html>.
1299
1300 ** Traces
1301 Popped tokens and nonterminals are now reported.
1302
1303 ** Larger grammars
1304 Larger grammars are now supported (larger token numbers, larger grammar
1305 size (= sum of the LHS and RHS lengths), larger LALR tables).
1306 Formerly, many of these numbers ran afoul of 16-bit limits;
1307 now these limits are 32 bits on most hosts.
1308
1309 ** Explicit initial rule
1310 Bison used to play hacks with the initial rule, which the user does
1311 not write. It is now explicit, and visible in the reports and
1312 graphs as rule 0.
1313
1314 ** Useless rules
1315 Before, Bison reported the useless rules, but, although not used,
1316 included them in the parsers. They are now actually removed.
1317
1318 ** Useless rules, useless nonterminals
1319 They are now reported, as a warning, with their locations.
1320
1321 ** Rules never reduced
1322 Rules that can never be reduced because of conflicts are now
1323 reported.
1324
1325 ** Incorrect `Token not used'
1326 On a grammar such as
1327
1328 %token useless useful
1329 %%
1330 exp: '0' %prec useful;
1331
1332 where a token was used to set the precedence of the last rule,
1333 bison reported both `useful' and `useless' as useless tokens.
1334
1335 ** Revert the C++ namespace changes introduced in 1.31
1336 as they caused too many portability hassles.
1337
1338 ** Default locations
1339 By an accident of design, the default computation of @$ was
1340 performed after another default computation was performed: @$ = @1.
1341 The latter is now removed: YYLLOC_DEFAULT is fully responsible of
1342 the computation of @$.
1343
1344 ** Token end-of-file
1345 The token end of file may be specified by the user, in which case,
1346 the user symbol is used in the reports, the graphs, and the verbose
1347 error messages instead of `$end', which remains being the default.
1348 For instance
1349 %token MYEOF 0
1350 or
1351 %token MYEOF 0 "end of file"
1352
1353 ** Semantic parser
1354 This old option, which has been broken for ages, is removed.
1355
1356 ** New translations
1357 Brazilian Portuguese, thanks to Alexandre Folle de Menezes.
1358 Croatian, thanks to Denis Lackovic.
1359
1360 ** Incorrect token definitions
1361 When given `%token 'a' "A"', Bison used to output `#define 'a' 65'.
1362
1363 ** Token definitions as enums
1364 Tokens are output both as the traditional #define's, and, provided
1365 the compiler supports ANSI C or is a C++ compiler, as enums.
1366 This lets debuggers display names instead of integers.
1367
1368 ** Reports
1369 In addition to --verbose, bison supports --report=THINGS, which
1370 produces additional information:
1371 - itemset
1372 complete the core item sets with their closure
1373 - lookahead [changed to `look-ahead' in 1.875e through 2.3, but changed back]
1374 explicitly associate lookahead tokens to items
1375 - solved
1376 describe shift/reduce conflicts solving.
1377 Bison used to systematically output this information on top of
1378 the report. Solved conflicts are now attached to their states.
1379
1380 ** Type clashes
1381 Previous versions don't complain when there is a type clash on
1382 the default action if the rule has a mid-rule action, such as in:
1383
1384 %type <foo> bar
1385 %%
1386 bar: '0' {} '0';
1387
1388 This is fixed.
1389
1390 ** GNU M4 is now required when using Bison.
1391 \f
1392 * Changes in version 1.35, 2002-03-25:
1393
1394 ** C Skeleton
1395 Some projects use Bison's C parser with C++ compilers, and define
1396 YYSTYPE as a class. The recent adjustment of C parsers for data
1397 alignment and 64 bit architectures made this impossible.
1398
1399 Because for the time being no real solution for C++ parser
1400 generation exists, kludges were implemented in the parser to
1401 maintain this use. In the future, when Bison has C++ parsers, this
1402 kludge will be disabled.
1403
1404 This kludge also addresses some C++ problems when the stack was
1405 extended.
1406 \f
1407 * Changes in version 1.34, 2002-03-12:
1408
1409 ** File name clashes are detected
1410 $ bison foo.y -d -o foo.x
1411 fatal error: header and parser would both be named `foo.x'
1412
1413 ** A missing `;' at the end of a rule triggers a warning
1414 In accordance with POSIX, and in agreement with other
1415 Yacc implementations, Bison will mandate this semicolon in the near
1416 future. This eases the implementation of a Bison parser of Bison
1417 grammars by making this grammar LALR(1) instead of LR(2). To
1418 facilitate the transition, this release introduces a warning.
1419
1420 ** Revert the C++ namespace changes introduced in 1.31, as they caused too
1421 many portability hassles.
1422
1423 ** DJGPP support added.
1424
1425 ** Fix test suite portability problems.
1426 \f
1427 * Changes in version 1.33, 2002-02-07:
1428
1429 ** Fix C++ issues
1430 Groff could not be compiled for the definition of size_t was lacking
1431 under some conditions.
1432
1433 ** Catch invalid @n
1434 As is done with $n.
1435 \f
1436 * Changes in version 1.32, 2002-01-23:
1437
1438 ** Fix Yacc output file names
1439
1440 ** Portability fixes
1441
1442 ** Italian, Dutch translations
1443 \f
1444 * Changes in version 1.31, 2002-01-14:
1445
1446 ** Many Bug Fixes
1447
1448 ** GNU Gettext and %expect
1449 GNU Gettext asserts 10 s/r conflicts, but there are 7. Now that
1450 Bison dies on incorrect %expectations, we fear there will be
1451 too many bug reports for Gettext, so _for the time being_, %expect
1452 does not trigger an error when the input file is named `plural.y'.
1453
1454 ** Use of alloca in parsers
1455 If YYSTACK_USE_ALLOCA is defined to 0, then the parsers will use
1456 malloc exclusively. Since 1.29, but was not NEWS'ed.
1457
1458 alloca is used only when compiled with GCC, to avoid portability
1459 problems as on AIX.
1460
1461 ** yyparse now returns 2 if memory is exhausted; formerly it dumped core.
1462
1463 ** When the generated parser lacks debugging code, YYDEBUG is now 0
1464 (as POSIX requires) instead of being undefined.
1465
1466 ** User Actions
1467 Bison has always permitted actions such as { $$ = $1 }: it adds the
1468 ending semicolon. Now if in Yacc compatibility mode, the semicolon
1469 is no longer output: one has to write { $$ = $1; }.
1470
1471 ** Better C++ compliance
1472 The output parsers try to respect C++ namespaces.
1473 [This turned out to be a failed experiment, and it was reverted later.]
1474
1475 ** Reduced Grammars
1476 Fixed bugs when reporting useless nonterminals.
1477
1478 ** 64 bit hosts
1479 The parsers work properly on 64 bit hosts.
1480
1481 ** Error messages
1482 Some calls to strerror resulted in scrambled or missing error messages.
1483
1484 ** %expect
1485 When the number of shift/reduce conflicts is correct, don't issue
1486 any warning.
1487
1488 ** The verbose report includes the rule line numbers.
1489
1490 ** Rule line numbers are fixed in traces.
1491
1492 ** Swedish translation
1493
1494 ** Parse errors
1495 Verbose parse error messages from the parsers are better looking.
1496 Before: parse error: unexpected `'/'', expecting `"number"' or `'-'' or `'(''
1497 Now: parse error: unexpected '/', expecting "number" or '-' or '('
1498
1499 ** Fixed parser memory leaks.
1500 When the generated parser was using malloc to extend its stacks, the
1501 previous allocations were not freed.
1502
1503 ** Fixed verbose output file.
1504 Some newlines were missing.
1505 Some conflicts in state descriptions were missing.
1506
1507 ** Fixed conflict report.
1508 Option -v was needed to get the result.
1509
1510 ** %expect
1511 Was not used.
1512 Mismatches are errors, not warnings.
1513
1514 ** Fixed incorrect processing of some invalid input.
1515
1516 ** Fixed CPP guards: 9foo.h uses BISON_9FOO_H instead of 9FOO_H.
1517
1518 ** Fixed some typos in the documentation.
1519
1520 ** %token MY_EOF 0 is supported.
1521 Before, MY_EOF was silently renumbered as 257.
1522
1523 ** doc/refcard.tex is updated.
1524
1525 ** %output, %file-prefix, %name-prefix.
1526 New.
1527
1528 ** --output
1529 New, aliasing `--output-file'.
1530 \f
1531 * Changes in version 1.30, 2001-10-26:
1532
1533 ** `--defines' and `--graph' have now an optional argument which is the
1534 output file name. `-d' and `-g' do not change; they do not take any
1535 argument.
1536
1537 ** `%source_extension' and `%header_extension' are removed, failed
1538 experiment.
1539
1540 ** Portability fixes.
1541 \f
1542 * Changes in version 1.29, 2001-09-07:
1543
1544 ** The output file does not define const, as this caused problems when used
1545 with common autoconfiguration schemes. If you still use ancient compilers
1546 that lack const, compile with the equivalent of the C compiler option
1547 `-Dconst='. Autoconf's AC_C_CONST macro provides one way to do this.
1548
1549 ** Added `-g' and `--graph'.
1550
1551 ** The Bison manual is now distributed under the terms of the GNU FDL.
1552
1553 ** The input and the output files has automatically a similar extension.
1554
1555 ** Russian translation added.
1556
1557 ** NLS support updated; should hopefully be less troublesome.
1558
1559 ** Added the old Bison reference card.
1560
1561 ** Added `--locations' and `%locations'.
1562
1563 ** Added `-S' and `--skeleton'.
1564
1565 ** `%raw', `-r', `--raw' is disabled.
1566
1567 ** Special characters are escaped when output. This solves the problems
1568 of the #line lines with path names including backslashes.
1569
1570 ** New directives.
1571 `%yacc', `%fixed_output_files', `%defines', `%no_parser', `%verbose',
1572 `%debug', `%source_extension' and `%header_extension'.
1573
1574 ** @$
1575 Automatic location tracking.
1576 \f
1577 * Changes in version 1.28, 1999-07-06:
1578
1579 ** Should compile better now with K&R compilers.
1580
1581 ** Added NLS.
1582
1583 ** Fixed a problem with escaping the double quote character.
1584
1585 ** There is now a FAQ.
1586 \f
1587 * Changes in version 1.27:
1588
1589 ** The make rule which prevented bison.simple from being created on
1590 some systems has been fixed.
1591 \f
1592 * Changes in version 1.26:
1593
1594 ** Bison now uses Automake.
1595
1596 ** New mailing lists: <bug-bison@gnu.org> and <help-bison@gnu.org>.
1597
1598 ** Token numbers now start at 257 as previously documented, not 258.
1599
1600 ** Bison honors the TMPDIR environment variable.
1601
1602 ** A couple of buffer overruns have been fixed.
1603
1604 ** Problems when closing files should now be reported.
1605
1606 ** Generated parsers should now work even on operating systems which do
1607 not provide alloca().
1608 \f
1609 * Changes in version 1.25, 1995-10-16:
1610
1611 ** Errors in the input grammar are not fatal; Bison keeps reading
1612 the grammar file, and reports all the errors found in it.
1613
1614 ** Tokens can now be specified as multiple-character strings: for
1615 example, you could use "<=" for a token which looks like <=, instead
1616 of choosing a name like LESSEQ.
1617
1618 ** The %token_table declaration says to write a table of tokens (names
1619 and numbers) into the parser file. The yylex function can use this
1620 table to recognize multiple-character string tokens, or for other
1621 purposes.
1622
1623 ** The %no_lines declaration says not to generate any #line preprocessor
1624 directives in the parser file.
1625
1626 ** The %raw declaration says to use internal Bison token numbers, not
1627 Yacc-compatible token numbers, when token names are defined as macros.
1628
1629 ** The --no-parser option produces the parser tables without including
1630 the parser engine; a project can now use its own parser engine.
1631 The actions go into a separate file called NAME.act, in the form of
1632 a switch statement body.
1633 \f
1634 * Changes in version 1.23:
1635
1636 The user can define YYPARSE_PARAM as the name of an argument to be
1637 passed into yyparse. The argument should have type void *. It should
1638 actually point to an object. Grammar actions can access the variable
1639 by casting it to the proper pointer type.
1640
1641 Line numbers in output file corrected.
1642 \f
1643 * Changes in version 1.22:
1644
1645 --help option added.
1646 \f
1647 * Changes in version 1.20:
1648
1649 Output file does not redefine const for C++.
1650
1651 -----
1652
1653 Copyright (C) 1995-2012 Free Software Foundation, Inc.
1654
1655 This file is part of Bison, the GNU Parser Generator.
1656
1657 This program is free software: you can redistribute it and/or modify
1658 it under the terms of the GNU General Public License as published by
1659 the Free Software Foundation, either version 3 of the License, or
1660 (at your option) any later version.
1661
1662 This program is distributed in the hope that it will be useful,
1663 but WITHOUT ANY WARRANTY; without even the implied warranty of
1664 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1665 GNU General Public License for more details.
1666
1667 You should have received a copy of the GNU General Public License
1668 along with this program. If not, see <http://www.gnu.org/licenses/>.
1669
1670 LocalWords: yacc YYBACKUP glr GCC lalr ArrayIndexOutOfBoundsException nullptr
1671 LocalWords: cplusplus liby rpl fprintf mfcalc Wyacc stmt cond expr mk sym lr
1672 LocalWords: IELR ielr Lookahead YYERROR nonassoc LALR's api lookaheads yychar
1673 LocalWords: destructor lookahead YYRHSLOC YYLLOC Rhs ifndef YYFAIL cpp sr rr
1674 LocalWords: preprocessor initializer Wno Wnone Werror FreeBSD prec livelocks
1675 LocalWords: Solaris AIX UX RHEL Tru LHS gcc's Wundef YYENABLE NLS YYLTYPE VCG
1676 LocalWords: yyerror cpp's Wunused yylval yylloc prepend yyparse yylex yypush
1677 LocalWords: Graphviz xml nonterminals midrule destructor's YYSTYPE typedef ly
1678 LocalWords: CHR chr printf stdout namespace preprocessing enum pre include's
1679 LocalWords: YYRECOVERING nonfree destructors YYABORT YYACCEPT params enums de
1680 LocalWords: struct yystype DJGPP lex param Haible NUM alloca YYSTACK NUL goto
1681 LocalWords: YYMAXDEPTH Unescaped UCNs YYLTYPE's yyltype typedefs inline Yaccs
1682 LocalWords: Heriyanto Reenable dprec Hilfinger Eggert MYEOF Folle Menezes EOF
1683 LocalWords: Lackovic define's itemset Groff Gettext malloc NEWS'ed YYDEBUG
1684 LocalWords: namespaces strerror const autoconfiguration Dconst Autoconf's FDL
1685 LocalWords: Automake TMPDIR LESSEQ
1686
1687 Local Variables:
1688 mode: outline
1689 End: