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