]> git.saurik.com Git - bison.git/blame_incremental - NEWS
doc: fix -W and %expect documentation some.
[bison.git] / NEWS
... / ...
CommitLineData
1Bison News
2----------
3
4* Changes in version 2.4.3 (????-??-??):
5
6** Bison now obeys -Werror and --warnings=error for warnings about
7 grammar rules that are useless in the parser due to conflicts.
8
9** Problems with spawning M4 on at least FreeBSD 8 and FreeBSD 9 have
10 been fixed.
11
12** Failures in the test suite for GCC 4.5 have been fixed.
13
14** Failures in the test suite for some versions of Sun Studio C++ have
15 been fixed.
16
17** Contrary to Bison 2.4.2's NEWS entry, it has been decided that
18 warnings about undefined %prec identifiers will not be converted to
19 errors in Bison 2.5. They will remain warnings, which should be
20 sufficient for POSIX while avoiding backward compatibility issues.
21
22** Minor documentation fixes.
23
24* Changes in version 2.4.2 (2010-03-20):
25
26** Some portability problems that resulted in failures and livelocks
27 in the test suite on some versions of at least Solaris, AIX, HP-UX,
28 RHEL4, and Tru64 have been addressed. As a result, fatal Bison
29 errors should no longer cause M4 to report a broken pipe on the
30 affected platforms.
31
32** `%prec IDENTIFIER' requires IDENTIFIER to be defined separately.
33
34 POSIX specifies that an error be reported for any identifier that does
35 not appear on the LHS of a grammar rule and that is not defined by
36 %token, %left, %right, or %nonassoc. Bison 2.3b and later lost this
37 error report for the case when an identifier appears only after a
38 %prec directive. It is now restored. However, for backward
39 compatibility with recent Bison releases, it is only a warning for
40 now. In Bison 2.5 and later, it will return to being an error.
41 [Between the 2.4.2 and 2.4.3 releases, it was decided that this
42 warning will not be converted to an error in Bison 2.5.]
43
44** Detection of GNU M4 1.4.6 or newer during configure is improved.
45
46** Warnings from gcc's -Wundef option about undefined YYENABLE_NLS,
47 YYLTYPE_IS_TRIVIAL, and __STRICT_ANSI__ in C/C++ parsers are now
48 avoided.
49
50** %code is now a permanent feature.
51
52 A traditional Yacc prologue directive is written in the form:
53
54 %{CODE%}
55
56 To provide a more flexible alternative, Bison 2.3b introduced the
57 %code directive with the following forms for C/C++:
58
59 %code {CODE}
60 %code requires {CODE}
61 %code provides {CODE}
62 %code top {CODE}
63
64 These forms are now considered permanent features of Bison. See the
65 %code entries in the section "Bison Declaration Summary" in the Bison
66 manual for a summary of their functionality. See the section
67 "Prologue Alternatives" for a detailed discussion including the
68 advantages of %code over the traditional Yacc prologue directive.
69
70 Bison's Java feature as a whole including its current usage of %code
71 is still considered experimental.
72
73** YYFAIL is deprecated and will eventually be removed.
74
75 YYFAIL has existed for many years as an undocumented feature of
76 deterministic parsers in C generated by Bison. Previously, it was
77 documented for Bison's experimental Java parsers. YYFAIL is no longer
78 documented for Java parsers and is formally deprecated in both cases.
79 Users are strongly encouraged to migrate to YYERROR, which is
80 specified by POSIX.
81
82 Like YYERROR, you can invoke YYFAIL from a semantic action in order to
83 induce a syntax error. The most obvious difference from YYERROR is
84 that YYFAIL will automatically invoke yyerror to report the syntax
85 error so that you don't have to. However, there are several other
86 subtle differences between YYERROR and YYFAIL, and YYFAIL suffers from
87 inherent flaws when %error-verbose or `#define YYERROR_VERBOSE' is
88 used. For a more detailed discussion, see:
89
90 http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html
91
92 The upcoming Bison 2.5 will remove YYFAIL from Java parsers, but
93 deterministic parsers in C will continue to implement it. However,
94 because YYFAIL is already flawed, it seems futile to try to make new
95 Bison features compatible with it. Thus, during parser generation,
96 Bison 2.5 will produce a warning whenever it discovers YYFAIL in a
97 rule action. In a later release, YYFAIL will be disabled for
98 %error-verbose and `#define YYERROR_VERBOSE'. Eventually, YYFAIL will
99 be removed altogether.
100
101 There exists at least one case where Bison 2.5's YYFAIL warning will
102 be a false positive. Some projects add phony uses of YYFAIL and other
103 Bison-defined macros for the sole purpose of suppressing C
104 preprocessor warnings (from GCC cpp's -Wunused-macros, for example).
105 To avoid Bison's future warning, such YYFAIL uses can be moved to the
106 epilogue (that is, after the second `%%') in the Bison input file. In
107 this release (2.4.2), Bison already generates its own code to suppress
108 C preprocessor warnings for YYFAIL, so projects can remove their own
109 phony uses of YYFAIL if compatibility with Bison releases prior to
110 2.4.2 is not necessary.
111
112** Internationalization.
113
114 Fix a regression introduced in Bison 2.4: Under some circumstances,
115 message translations were not installed although supported by the
116 host system.
117
118* Changes in version 2.4.1 (2008-12-11):
119
120** In the GLR defines file, unexpanded M4 macros in the yylval and yylloc
121 declarations have been fixed.
122
123** Temporary hack for adding a semicolon to the user action.
124
125 Bison used to prepend a trailing semicolon at the end of the user
126 action for reductions. This allowed actions such as
127
128 exp: exp "+" exp { $$ = $1 + $3 };
129
130 instead of
131
132 exp: exp "+" exp { $$ = $1 + $3; };
133
134 Some grammars still depend on this `feature'. Bison 2.4.1 restores
135 the previous behavior in the case of C output (specifically, when
136 neither %language or %skeleton or equivalent command-line options
137 are used) to leave more time for grammars depending on the old
138 behavior to be adjusted. Future releases of Bison will disable this
139 feature.
140
141** A few minor improvements to the Bison manual.
142
143* Changes in version 2.4 (2008-11-02):
144
145** %language is an experimental feature.
146
147 We first introduced this feature in test release 2.3b as a cleaner
148 alternative to %skeleton. Since then, we have discussed the possibility of
149 modifying its effect on Bison's output file names. Thus, in this release,
150 we consider %language to be an experimental feature that will likely evolve
151 in future releases.
152
153** Forward compatibility with GNU M4 has been improved.
154
155** Several bugs in the C++ skeleton and the experimental Java skeleton have been
156 fixed.
157
158* Changes in version 2.3b (2008-05-27):
159
160** The quotes around NAME that used to be required in the following directive
161 are now deprecated:
162
163 %define NAME "VALUE"
164
165** The directive `%pure-parser' is now deprecated in favor of:
166
167 %define api.pure
168
169 which has the same effect except that Bison is more careful to warn about
170 unreasonable usage in the latter case.
171
172** Push Parsing
173
174 Bison can now generate an LALR(1) parser in C with a push interface. That
175 is, instead of invoking `yyparse', which pulls tokens from `yylex', you can
176 push one token at a time to the parser using `yypush_parse', which will
177 return to the caller after processing each token. By default, the push
178 interface is disabled. Either of the following directives will enable it:
179
180 %define api.push_pull "push" // Just push; does not require yylex.
181 %define api.push_pull "both" // Push and pull; requires yylex.
182
183 See the new section `A Push Parser' in the Bison manual for details.
184
185 The current push parsing interface is experimental and may evolve. More user
186 feedback will help to stabilize it.
187
188** The -g and --graph options now output graphs in Graphviz DOT format,
189 not VCG format. Like --graph, -g now also takes an optional FILE argument
190 and thus cannot be bundled with other short options.
191
192** Java
193
194 Bison can now generate an LALR(1) parser in Java. The skeleton is
195 `data/lalr1.java'. Consider using the new %language directive instead of
196 %skeleton to select it.
197
198 See the new section `Java Parsers' in the Bison manual for details.
199
200 The current Java interface is experimental and may evolve. More user
201 feedback will help to stabilize it.
202
203** %language
204
205 This new directive specifies the programming language of the generated
206 parser, which can be C (the default), C++, or Java. Besides the skeleton
207 that Bison uses, the directive affects the names of the generated files if
208 the grammar file's name ends in ".y".
209
210** XML Automaton Report
211
212 Bison can now generate an XML report of the LALR(1) automaton using the new
213 `--xml' option. The current XML schema is experimental and may evolve. More
214 user feedback will help to stabilize it.
215
216** The grammar file may now specify the name of the parser header file using
217 %defines. For example:
218
219 %defines "parser.h"
220
221** When reporting useless rules, useless nonterminals, and unused terminals,
222 Bison now employs the terms "useless in grammar" instead of "useless",
223 "useless in parser" instead of "never reduced", and "unused in grammar"
224 instead of "unused".
225
226** Unreachable State Removal
227
228 Previously, Bison sometimes generated parser tables containing unreachable
229 states. A state can become unreachable during conflict resolution if Bison
230 disables a shift action leading to it from a predecessor state. Bison now:
231
232 1. Removes unreachable states.
233
234 2. Does not report any conflicts that appeared in unreachable states.
235 WARNING: As a result, you may need to update %expect and %expect-rr
236 directives in existing grammar files.
237
238 3. For any rule used only in such states, Bison now reports the rule as
239 "useless in parser due to conflicts".
240
241 This feature can be disabled with the following directive:
242
243 %define lr.keep_unreachable_states
244
245 See the %define entry in the `Bison Declaration Summary' in the Bison manual
246 for further discussion.
247
248** Lookahead Set Correction in the `.output' Report
249
250 When instructed to generate a `.output' file including lookahead sets
251 (using `--report=lookahead', for example), Bison now prints each reduction's
252 lookahead set only next to the associated state's one item that (1) is
253 associated with the same rule as the reduction and (2) has its dot at the end
254 of its RHS. Previously, Bison also erroneously printed the lookahead set
255 next to all of the state's other items associated with the same rule. This
256 bug affected only the `.output' file and not the generated parser source
257 code.
258
259** --report-file=FILE is a new option to override the default `.output' file
260 name.
261
262** The `=' that used to be required in the following directives is now
263 deprecated:
264
265 %file-prefix "parser"
266 %name-prefix "c_"
267 %output "parser.c"
268
269** An Alternative to `%{...%}' -- `%code QUALIFIER {CODE}'
270
271 Bison 2.3a provided a new set of directives as a more flexible alternative to
272 the traditional Yacc prologue blocks. Those have now been consolidated into
273 a single %code directive with an optional qualifier field, which identifies
274 the purpose of the code and thus the location(s) where Bison should generate
275 it:
276
277 1. `%code {CODE}' replaces `%after-header {CODE}'
278 2. `%code requires {CODE}' replaces `%start-header {CODE}'
279 3. `%code provides {CODE}' replaces `%end-header {CODE}'
280 4. `%code top {CODE}' replaces `%before-header {CODE}'
281
282 See the %code entries in section `Bison Declaration Summary' in the Bison
283 manual for a summary of the new functionality. See the new section `Prologue
284 Alternatives' for a detailed discussion including the advantages of %code
285 over the traditional Yacc prologues.
286
287 The prologue alternatives are experimental. More user feedback will help to
288 determine whether they should become permanent features.
289
290** Revised warning: unset or unused mid-rule values
291
292 Since Bison 2.2, Bison has warned about mid-rule values that are set but not
293 used within any of the actions of the parent rule. For example, Bison warns
294 about unused $2 in:
295
296 exp: '1' { $$ = 1; } '+' exp { $$ = $1 + $4; };
297
298 Now, Bison also warns about mid-rule values that are used but not set. For
299 example, Bison warns about unset $$ in the mid-rule action in:
300
301 exp: '1' { $1 = 1; } '+' exp { $$ = $2 + $4; };
302
303 However, Bison now disables both of these warnings by default since they
304 sometimes prove to be false alarms in existing grammars employing the Yacc
305 constructs $0 or $-N (where N is some positive integer).
306
307 To enable these warnings, specify the option `--warnings=midrule-values' or
308 `-W', which is a synonym for `--warnings=all'.
309
310** Default %destructor or %printer with `<*>' or `<>'
311
312 Bison now recognizes two separate kinds of default %destructor's and
313 %printer's:
314
315 1. Place `<*>' in a %destructor/%printer symbol list to define a default
316 %destructor/%printer for all grammar symbols for which you have formally
317 declared semantic type tags.
318
319 2. Place `<>' in a %destructor/%printer symbol list to define a default
320 %destructor/%printer for all grammar symbols without declared semantic
321 type tags.
322
323 Bison no longer supports the `%symbol-default' notation from Bison 2.3a.
324 `<*>' and `<>' combined achieve the same effect with one exception: Bison no
325 longer applies any %destructor to a mid-rule value if that mid-rule value is
326 not actually ever referenced using either $$ or $n in a semantic action.
327
328 The default %destructor's and %printer's are experimental. More user
329 feedback will help to determine whether they should become permanent
330 features.
331
332 See the section `Freeing Discarded Symbols' in the Bison manual for further
333 details.
334
335** %left, %right, and %nonassoc can now declare token numbers. This is required
336 by POSIX. However, see the end of section `Operator Precedence' in the Bison
337 manual for a caveat concerning the treatment of literal strings.
338
339** The nonfunctional --no-parser, -n, and %no-parser options have been
340 completely removed from Bison.
341
342* Changes in version 2.3a, 2006-09-13:
343
344** Instead of %union, you can define and use your own union type
345 YYSTYPE if your grammar contains at least one <type> tag.
346 Your YYSTYPE need not be a macro; it can be a typedef.
347 This change is for compatibility with other Yacc implementations,
348 and is required by POSIX.
349
350** Locations columns and lines start at 1.
351 In accordance with the GNU Coding Standards and Emacs.
352
353** You may now declare per-type and default %destructor's and %printer's:
354
355 For example:
356
357 %union { char *string; }
358 %token <string> STRING1
359 %token <string> STRING2
360 %type <string> string1
361 %type <string> string2
362 %union { char character; }
363 %token <character> CHR
364 %type <character> chr
365 %destructor { free ($$); } %symbol-default
366 %destructor { free ($$); printf ("%d", @$.first_line); } STRING1 string1
367 %destructor { } <character>
368
369 guarantees that, when the parser discards any user-defined symbol that has a
370 semantic type tag other than `<character>', it passes its semantic value to
371 `free'. However, when the parser discards a `STRING1' or a `string1', it
372 also prints its line number to `stdout'. It performs only the second
373 `%destructor' in this case, so it invokes `free' only once.
374
375 [Although we failed to mention this here in the 2.3a release, the default
376 %destructor's and %printer's were experimental, and they were rewritten in
377 future versions.]
378
379** Except for LALR(1) parsers in C with POSIX Yacc emulation enabled (with `-y',
380 `--yacc', or `%yacc'), Bison no longer generates #define statements for
381 associating token numbers with token names. Removing the #define statements
382 helps to sanitize the global namespace during preprocessing, but POSIX Yacc
383 requires them. Bison still generates an enum for token names in all cases.
384
385** Handling of traditional Yacc prologue blocks is now more consistent but
386 potentially incompatible with previous releases of Bison.
387
388 As before, you declare prologue blocks in your grammar file with the
389 `%{ ... %}' syntax. To generate the pre-prologue, Bison concatenates all
390 prologue blocks that you've declared before the first %union. To generate
391 the post-prologue, Bison concatenates all prologue blocks that you've
392 declared after the first %union.
393
394 Previous releases of Bison inserted the pre-prologue into both the header
395 file and the code file in all cases except for LALR(1) parsers in C. In the
396 latter case, Bison inserted it only into the code file. For parsers in C++,
397 the point of insertion was before any token definitions (which associate
398 token numbers with names). For parsers in C, the point of insertion was
399 after the token definitions.
400
401 Now, Bison never inserts the pre-prologue into the header file. In the code
402 file, it always inserts it before the token definitions.
403
404** Bison now provides a more flexible alternative to the traditional Yacc
405 prologue blocks: %before-header, %start-header, %end-header, and
406 %after-header.
407
408 For example, the following declaration order in the grammar file reflects the
409 order in which Bison will output these code blocks. However, you are free to
410 declare these code blocks in your grammar file in whatever order is most
411 convenient for you:
412
413 %before-header {
414 /* Bison treats this block like a pre-prologue block: it inserts it into
415 * the code file before the contents of the header file. It does *not*
416 * insert it into the header file. This is a good place to put
417 * #include's that you want at the top of your code file. A common
418 * example is `#include "system.h"'. */
419 }
420 %start-header {
421 /* Bison inserts this block into both the header file and the code file.
422 * In both files, the point of insertion is before any Bison-generated
423 * token, semantic type, location type, and class definitions. This is a
424 * good place to define %union dependencies, for example. */
425 }
426 %union {
427 /* Unlike the traditional Yacc prologue blocks, the output order for the
428 * new %*-header blocks is not affected by their declaration position
429 * relative to any %union in the grammar file. */
430 }
431 %end-header {
432 /* Bison inserts this block into both the header file and the code file.
433 * In both files, the point of insertion is after the Bison-generated
434 * definitions. This is a good place to declare or define public
435 * functions or data structures that depend on the Bison-generated
436 * definitions. */
437 }
438 %after-header {
439 /* Bison treats this block like a post-prologue block: it inserts it into
440 * the code file after the contents of the header file. It does *not*
441 * insert it into the header file. This is a good place to declare or
442 * define internal functions or data structures that depend on the
443 * Bison-generated definitions. */
444 }
445
446 If you have multiple occurrences of any one of the above declarations, Bison
447 will concatenate the contents in declaration order.
448
449 [Although we failed to mention this here in the 2.3a release, the prologue
450 alternatives were experimental, and they were rewritten in future versions.]
451
452** The option `--report=look-ahead' has been changed to `--report=lookahead'.
453 The old spelling still works, but is not documented and may be removed
454 in a future release.
455
456* Changes in version 2.3, 2006-06-05:
457
458** GLR grammars should now use `YYRECOVERING ()' instead of `YYRECOVERING',
459 for compatibility with LALR(1) grammars.
460
461** It is now documented that any definition of YYSTYPE or YYLTYPE should
462 be to a type name that does not contain parentheses or brackets.
463
464* Changes in version 2.2, 2006-05-19:
465
466** The distribution terms for all Bison-generated parsers now permit
467 using the parsers in nonfree programs. Previously, this permission
468 was granted only for Bison-generated LALR(1) parsers in C.
469
470** %name-prefix changes the namespace name in C++ outputs.
471
472** The C++ parsers export their token_type.
473
474** Bison now allows multiple %union declarations, and concatenates
475 their contents together.
476
477** New warning: unused values
478 Right-hand side symbols whose values are not used are reported,
479 if the symbols have destructors. For instance:
480
481 exp: exp "?" exp ":" exp { $1 ? $1 : $3; }
482 | exp "+" exp
483 ;
484
485 will trigger a warning about $$ and $5 in the first rule, and $3 in
486 the second ($1 is copied to $$ by the default rule). This example
487 most likely contains three errors, and could be rewritten as:
488
489 exp: exp "?" exp ":" exp
490 { $$ = $1 ? $3 : $5; free ($1 ? $5 : $3); free ($1); }
491 | exp "+" exp
492 { $$ = $1 ? $1 : $3; if ($1) free ($3); }
493 ;
494
495 However, if the original actions were really intended, memory leaks
496 and all, the warnings can be suppressed by letting Bison believe the
497 values are used, e.g.:
498
499 exp: exp "?" exp ":" exp { $1 ? $1 : $3; (void) ($$, $5); }
500 | exp "+" exp { $$ = $1; (void) $3; }
501 ;
502
503 If there are mid-rule actions, the warning is issued if no action
504 uses it. The following triggers no warning: $1 and $3 are used.
505
506 exp: exp { push ($1); } '+' exp { push ($3); sum (); };
507
508 The warning is intended to help catching lost values and memory leaks.
509 If a value is ignored, its associated memory typically is not reclaimed.
510
511** %destructor vs. YYABORT, YYACCEPT, and YYERROR.
512 Destructors are now called when user code invokes YYABORT, YYACCEPT,
513 and YYERROR, for all objects on the stack, other than objects
514 corresponding to the right-hand side of the current rule.
515
516** %expect, %expect-rr
517 Incorrect numbers of expected conflicts are now actual errors,
518 instead of warnings.
519
520** GLR, YACC parsers.
521 The %parse-params are available in the destructors (and the
522 experimental printers) as per the documentation.
523
524** Bison now warns if it finds a stray `$' or `@' in an action.
525
526** %require "VERSION"
527 This specifies that the grammar file depends on features implemented
528 in Bison version VERSION or higher.
529
530** lalr1.cc: The token and value types are now class members.
531 The tokens were defined as free form enums and cpp macros. YYSTYPE
532 was defined as a free form union. They are now class members:
533 tokens are enumerations of the `yy::parser::token' struct, and the
534 semantic values have the `yy::parser::semantic_type' type.
535
536 If you do not want or can update to this scheme, the directive
537 `%define "global_tokens_and_yystype" "1"' triggers the global
538 definition of tokens and YYSTYPE. This change is suitable both
539 for previous releases of Bison, and this one.
540
541 If you wish to update, then make sure older version of Bison will
542 fail using `%require "2.2"'.
543
544** DJGPP support added.
545\f
546* Changes in version 2.1, 2005-09-16:
547
548** The C++ lalr1.cc skeleton supports %lex-param.
549
550** Bison-generated parsers now support the translation of diagnostics like
551 "syntax error" into languages other than English. The default
552 language is still English. For details, please see the new
553 Internationalization section of the Bison manual. Software
554 distributors should also see the new PACKAGING file. Thanks to
555 Bruno Haible for this new feature.
556
557** Wording in the Bison-generated parsers has been changed slightly to
558 simplify translation. In particular, the message "memory exhausted"
559 has replaced "parser stack overflow", as the old message was not
560 always accurate for modern Bison-generated parsers.
561
562** Destructors are now called when the parser aborts, for all symbols left
563 behind on the stack. Also, the start symbol is now destroyed after a
564 successful parse. In both cases, the behavior was formerly inconsistent.
565
566** When generating verbose diagnostics, Bison-generated parsers no longer
567 quote the literal strings associated with tokens. For example, for
568 a syntax error associated with '%token NUM "number"' they might
569 print 'syntax error, unexpected number' instead of 'syntax error,
570 unexpected "number"'.
571\f
572* Changes in version 2.0, 2004-12-25:
573
574** Possibly-incompatible changes
575
576 - Bison-generated parsers no longer default to using the alloca function
577 (when available) to extend the parser stack, due to widespread
578 problems in unchecked stack-overflow detection. You can "#define
579 YYSTACK_USE_ALLOCA 1" to require the use of alloca, but please read
580 the manual to determine safe values for YYMAXDEPTH in that case.
581
582 - Error token location.
583 During error recovery, the location of the syntax error is updated
584 to cover the whole sequence covered by the error token: it includes
585 the shifted symbols thrown away during the first part of the error
586 recovery, and the lookahead rejected during the second part.
587
588 - Semicolon changes:
589 . Stray semicolons are no longer allowed at the start of a grammar.
590 . Semicolons are now required after in-grammar declarations.
591
592 - Unescaped newlines are no longer allowed in character constants or
593 string literals. They were never portable, and GCC 3.4.0 has
594 dropped support for them. Better diagnostics are now generated if
595 forget a closing quote.
596
597 - NUL bytes are no longer allowed in Bison string literals, unfortunately.
598
599** New features
600
601 - GLR grammars now support locations.
602
603 - New directive: %initial-action.
604 This directive allows the user to run arbitrary code (including
605 initializing @$) from yyparse before parsing starts.
606
607 - A new directive "%expect-rr N" specifies the expected number of
608 reduce/reduce conflicts in GLR parsers.
609
610 - %token numbers can now be hexadecimal integers, e.g., `%token FOO 0x12d'.
611 This is a GNU extension.
612
613 - The option `--report=lookahead' was changed to `--report=look-ahead'.
614 [However, this was changed back after 2.3.]
615
616 - Experimental %destructor support has been added to lalr1.cc.
617
618 - New configure option --disable-yacc, to disable installation of the
619 yacc command and -ly library introduced in 1.875 for POSIX conformance.
620
621** Bug fixes
622
623 - For now, %expect-count violations are now just warnings, not errors.
624 This is for compatibility with Bison 1.75 and earlier (when there are
625 reduce/reduce conflicts) and with Bison 1.30 and earlier (when there
626 are too many or too few shift/reduce conflicts). However, in future
627 versions of Bison we plan to improve the %expect machinery so that
628 these violations will become errors again.
629
630 - Within Bison itself, numbers (e.g., goto numbers) are no longer
631 arbitrarily limited to 16-bit counts.
632
633 - Semicolons are now allowed before "|" in grammar rules, as POSIX requires.
634\f
635* Changes in version 1.875, 2003-01-01:
636
637** The documentation license has been upgraded to version 1.2
638 of the GNU Free Documentation License.
639
640** syntax error processing
641
642 - In Yacc-style parsers YYLLOC_DEFAULT is now used to compute error
643 locations too. This fixes bugs in error-location computation.
644
645 - %destructor
646 It is now possible to reclaim the memory associated to symbols
647 discarded during error recovery. This feature is still experimental.
648
649 - %error-verbose
650 This new directive is preferred over YYERROR_VERBOSE.
651
652 - #defining yyerror to steal internal variables is discouraged.
653 It is not guaranteed to work forever.
654
655** POSIX conformance
656
657 - Semicolons are once again optional at the end of grammar rules.
658 This reverts to the behavior of Bison 1.33 and earlier, and improves
659 compatibility with Yacc.
660
661 - `parse error' -> `syntax error'
662 Bison now uniformly uses the term `syntax error'; formerly, the code
663 and manual sometimes used the term `parse error' instead. POSIX
664 requires `syntax error' in diagnostics, and it was thought better to
665 be consistent.
666
667 - The documentation now emphasizes that yylex and yyerror must be
668 declared before use. C99 requires this.
669
670 - Bison now parses C99 lexical constructs like UCNs and
671 backslash-newline within C escape sequences, as POSIX 1003.1-2001 requires.
672
673 - File names are properly escaped in C output. E.g., foo\bar.y is
674 output as "foo\\bar.y".
675
676 - Yacc command and library now available
677 The Bison distribution now installs a `yacc' command, as POSIX requires.
678 Also, Bison now installs a small library liby.a containing
679 implementations of Yacc-compatible yyerror and main functions.
680 This library is normally not useful, but POSIX requires it.
681
682 - Type clashes now generate warnings, not errors.
683
684 - If the user does not define YYSTYPE as a macro, Bison now declares it
685 using typedef instead of defining it as a macro.
686 For consistency, YYLTYPE is also declared instead of defined.
687
688** Other compatibility issues
689
690 - %union directives can now have a tag before the `{', e.g., the
691 directive `%union foo {...}' now generates the C code
692 `typedef union foo { ... } YYSTYPE;'; this is for Yacc compatibility.
693 The default union tag is `YYSTYPE', for compatibility with Solaris 9 Yacc.
694 For consistency, YYLTYPE's struct tag is now `YYLTYPE' not `yyltype'.
695 This is for compatibility with both Yacc and Bison 1.35.
696
697 - `;' is output before the terminating `}' of an action, for
698 compatibility with Bison 1.35.
699
700 - Bison now uses a Yacc-style format for conflict reports, e.g.,
701 `conflicts: 2 shift/reduce, 1 reduce/reduce'.
702
703 - `yystype' and `yyltype' are now obsolescent macros instead of being
704 typedefs or tags; they are no longer documented and are planned to be
705 withdrawn in a future release.
706
707** GLR parser notes
708
709 - GLR and inline
710 Users of Bison have to decide how they handle the portability of the
711 C keyword `inline'.
712
713 - `parsing stack overflow...' -> `parser stack overflow'
714 GLR parsers now report `parser stack overflow' as per the Bison manual.
715
716** Bison now warns if it detects conflicting outputs to the same file,
717 e.g., it generates a warning for `bison -d -o foo.h foo.y' since
718 that command outputs both code and header to foo.h.
719
720** #line in output files
721 - --no-line works properly.
722
723** Bison can no longer be built by a K&R C compiler; it requires C89 or
724 later to be built. This change originally took place a few versions
725 ago, but nobody noticed until we recently asked someone to try
726 building Bison with a K&R C compiler.
727\f
728* Changes in version 1.75, 2002-10-14:
729
730** Bison should now work on 64-bit hosts.
731
732** Indonesian translation thanks to Tedi Heriyanto.
733
734** GLR parsers
735 Fix spurious parse errors.
736
737** Pure parsers
738 Some people redefine yyerror to steal yyparse' private variables.
739 Reenable this trick until an official feature replaces it.
740
741** Type Clashes
742 In agreement with POSIX and with other Yaccs, leaving a default
743 action is valid when $$ is untyped, and $1 typed:
744
745 untyped: ... typed;
746
747 but the converse remains an error:
748
749 typed: ... untyped;
750
751** Values of mid-rule actions
752 The following code:
753
754 foo: { ... } { $$ = $1; } ...
755
756 was incorrectly rejected: $1 is defined in the second mid-rule
757 action, and is equal to the $$ of the first mid-rule action.
758\f
759* Changes in version 1.50, 2002-10-04:
760
761** GLR parsing
762 The declaration
763 %glr-parser
764 causes Bison to produce a Generalized LR (GLR) parser, capable of handling
765 almost any context-free grammar, ambiguous or not. The new declarations
766 %dprec and %merge on grammar rules allow parse-time resolution of
767 ambiguities. Contributed by Paul Hilfinger.
768
769 Unfortunately Bison 1.50 does not work properly on 64-bit hosts
770 like the Alpha, so please stick to 32-bit hosts for now.
771
772** Output Directory
773 When not in Yacc compatibility mode, when the output file was not
774 specified, running `bison foo/bar.y' created `foo/bar.c'. It
775 now creates `bar.c'.
776
777** Undefined token
778 The undefined token was systematically mapped to 2 which prevented
779 the use of 2 by the user. This is no longer the case.
780
781** Unknown token numbers
782 If yylex returned an out of range value, yyparse could die. This is
783 no longer the case.
784
785** Error token
786 According to POSIX, the error token must be 256.
787 Bison extends this requirement by making it a preference: *if* the
788 user specified that one of her tokens is numbered 256, then error
789 will be mapped onto another number.
790
791** Verbose error messages
792 They no longer report `..., expecting error or...' for states where
793 error recovery is possible.
794
795** End token
796 Defaults to `$end' instead of `$'.
797
798** Error recovery now conforms to documentation and to POSIX
799 When a Bison-generated parser encounters a syntax error, it now pops
800 the stack until it finds a state that allows shifting the error
801 token. Formerly, it popped the stack until it found a state that
802 allowed some non-error action other than a default reduction on the
803 error token. The new behavior has long been the documented behavior,
804 and has long been required by POSIX. For more details, please see
805 Paul Eggert, "Reductions during Bison error handling" (2002-05-20)
806 <http://lists.gnu.org/archive/html/bug-bison/2002-05/msg00038.html>.
807
808** Traces
809 Popped tokens and nonterminals are now reported.
810
811** Larger grammars
812 Larger grammars are now supported (larger token numbers, larger grammar
813 size (= sum of the LHS and RHS lengths), larger LALR tables).
814 Formerly, many of these numbers ran afoul of 16-bit limits;
815 now these limits are 32 bits on most hosts.
816
817** Explicit initial rule
818 Bison used to play hacks with the initial rule, which the user does
819 not write. It is now explicit, and visible in the reports and
820 graphs as rule 0.
821
822** Useless rules
823 Before, Bison reported the useless rules, but, although not used,
824 included them in the parsers. They are now actually removed.
825
826** Useless rules, useless nonterminals
827 They are now reported, as a warning, with their locations.
828
829** Rules never reduced
830 Rules that can never be reduced because of conflicts are now
831 reported.
832
833** Incorrect `Token not used'
834 On a grammar such as
835
836 %token useless useful
837 %%
838 exp: '0' %prec useful;
839
840 where a token was used to set the precedence of the last rule,
841 bison reported both `useful' and `useless' as useless tokens.
842
843** Revert the C++ namespace changes introduced in 1.31
844 as they caused too many portability hassles.
845
846** Default locations
847 By an accident of design, the default computation of @$ was
848 performed after another default computation was performed: @$ = @1.
849 The latter is now removed: YYLLOC_DEFAULT is fully responsible of
850 the computation of @$.
851
852** Token end-of-file
853 The token end of file may be specified by the user, in which case,
854 the user symbol is used in the reports, the graphs, and the verbose
855 error messages instead of `$end', which remains being the default.
856 For instance
857 %token MYEOF 0
858 or
859 %token MYEOF 0 "end of file"
860
861** Semantic parser
862 This old option, which has been broken for ages, is removed.
863
864** New translations
865 Brazilian Portuguese, thanks to Alexandre Folle de Menezes.
866 Croatian, thanks to Denis Lackovic.
867
868** Incorrect token definitions
869 When given `%token 'a' "A"', Bison used to output `#define 'a' 65'.
870
871** Token definitions as enums
872 Tokens are output both as the traditional #define's, and, provided
873 the compiler supports ANSI C or is a C++ compiler, as enums.
874 This lets debuggers display names instead of integers.
875
876** Reports
877 In addition to --verbose, bison supports --report=THINGS, which
878 produces additional information:
879 - itemset
880 complete the core item sets with their closure
881 - lookahead [changed to `look-ahead' in 1.875e through 2.3, but changed back]
882 explicitly associate lookahead tokens to items
883 - solved
884 describe shift/reduce conflicts solving.
885 Bison used to systematically output this information on top of
886 the report. Solved conflicts are now attached to their states.
887
888** Type clashes
889 Previous versions don't complain when there is a type clash on
890 the default action if the rule has a mid-rule action, such as in:
891
892 %type <foo> bar
893 %%
894 bar: '0' {} '0';
895
896 This is fixed.
897
898** GNU M4 is now required when using Bison.
899\f
900* Changes in version 1.35, 2002-03-25:
901
902** C Skeleton
903 Some projects use Bison's C parser with C++ compilers, and define
904 YYSTYPE as a class. The recent adjustment of C parsers for data
905 alignment and 64 bit architectures made this impossible.
906
907 Because for the time being no real solution for C++ parser
908 generation exists, kludges were implemented in the parser to
909 maintain this use. In the future, when Bison has C++ parsers, this
910 kludge will be disabled.
911
912 This kludge also addresses some C++ problems when the stack was
913 extended.
914\f
915* Changes in version 1.34, 2002-03-12:
916
917** File name clashes are detected
918 $ bison foo.y -d -o foo.x
919 fatal error: header and parser would both be named `foo.x'
920
921** A missing `;' at the end of a rule triggers a warning
922 In accordance with POSIX, and in agreement with other
923 Yacc implementations, Bison will mandate this semicolon in the near
924 future. This eases the implementation of a Bison parser of Bison
925 grammars by making this grammar LALR(1) instead of LR(2). To
926 facilitate the transition, this release introduces a warning.
927
928** Revert the C++ namespace changes introduced in 1.31, as they caused too
929 many portability hassles.
930
931** DJGPP support added.
932
933** Fix test suite portability problems.
934\f
935* Changes in version 1.33, 2002-02-07:
936
937** Fix C++ issues
938 Groff could not be compiled for the definition of size_t was lacking
939 under some conditions.
940
941** Catch invalid @n
942 As is done with $n.
943\f
944* Changes in version 1.32, 2002-01-23:
945
946** Fix Yacc output file names
947
948** Portability fixes
949
950** Italian, Dutch translations
951\f
952* Changes in version 1.31, 2002-01-14:
953
954** Many Bug Fixes
955
956** GNU Gettext and %expect
957 GNU Gettext asserts 10 s/r conflicts, but there are 7. Now that
958 Bison dies on incorrect %expectations, we fear there will be
959 too many bug reports for Gettext, so _for the time being_, %expect
960 does not trigger an error when the input file is named `plural.y'.
961
962** Use of alloca in parsers
963 If YYSTACK_USE_ALLOCA is defined to 0, then the parsers will use
964 malloc exclusively. Since 1.29, but was not NEWS'ed.
965
966 alloca is used only when compiled with GCC, to avoid portability
967 problems as on AIX.
968
969** yyparse now returns 2 if memory is exhausted; formerly it dumped core.
970
971** When the generated parser lacks debugging code, YYDEBUG is now 0
972 (as POSIX requires) instead of being undefined.
973
974** User Actions
975 Bison has always permitted actions such as { $$ = $1 }: it adds the
976 ending semicolon. Now if in Yacc compatibility mode, the semicolon
977 is no longer output: one has to write { $$ = $1; }.
978
979** Better C++ compliance
980 The output parsers try to respect C++ namespaces.
981 [This turned out to be a failed experiment, and it was reverted later.]
982
983** Reduced Grammars
984 Fixed bugs when reporting useless nonterminals.
985
986** 64 bit hosts
987 The parsers work properly on 64 bit hosts.
988
989** Error messages
990 Some calls to strerror resulted in scrambled or missing error messages.
991
992** %expect
993 When the number of shift/reduce conflicts is correct, don't issue
994 any warning.
995
996** The verbose report includes the rule line numbers.
997
998** Rule line numbers are fixed in traces.
999
1000** Swedish translation
1001
1002** Parse errors
1003 Verbose parse error messages from the parsers are better looking.
1004 Before: parse error: unexpected `'/'', expecting `"number"' or `'-'' or `'(''
1005 Now: parse error: unexpected '/', expecting "number" or '-' or '('
1006
1007** Fixed parser memory leaks.
1008 When the generated parser was using malloc to extend its stacks, the
1009 previous allocations were not freed.
1010
1011** Fixed verbose output file.
1012 Some newlines were missing.
1013 Some conflicts in state descriptions were missing.
1014
1015** Fixed conflict report.
1016 Option -v was needed to get the result.
1017
1018** %expect
1019 Was not used.
1020 Mismatches are errors, not warnings.
1021
1022** Fixed incorrect processing of some invalid input.
1023
1024** Fixed CPP guards: 9foo.h uses BISON_9FOO_H instead of 9FOO_H.
1025
1026** Fixed some typos in the documentation.
1027
1028** %token MY_EOF 0 is supported.
1029 Before, MY_EOF was silently renumbered as 257.
1030
1031** doc/refcard.tex is updated.
1032
1033** %output, %file-prefix, %name-prefix.
1034 New.
1035
1036** --output
1037 New, aliasing `--output-file'.
1038\f
1039* Changes in version 1.30, 2001-10-26:
1040
1041** `--defines' and `--graph' have now an optional argument which is the
1042 output file name. `-d' and `-g' do not change; they do not take any
1043 argument.
1044
1045** `%source_extension' and `%header_extension' are removed, failed
1046 experiment.
1047
1048** Portability fixes.
1049\f
1050* Changes in version 1.29, 2001-09-07:
1051
1052** The output file does not define const, as this caused problems when used
1053 with common autoconfiguration schemes. If you still use ancient compilers
1054 that lack const, compile with the equivalent of the C compiler option
1055 `-Dconst='. autoconf's AC_C_CONST macro provides one way to do this.
1056
1057** Added `-g' and `--graph'.
1058
1059** The Bison manual is now distributed under the terms of the GNU FDL.
1060
1061** The input and the output files has automatically a similar extension.
1062
1063** Russian translation added.
1064
1065** NLS support updated; should hopefully be less troublesome.
1066
1067** Added the old Bison reference card.
1068
1069** Added `--locations' and `%locations'.
1070
1071** Added `-S' and `--skeleton'.
1072
1073** `%raw', `-r', `--raw' is disabled.
1074
1075** Special characters are escaped when output. This solves the problems
1076 of the #line lines with path names including backslashes.
1077
1078** New directives.
1079 `%yacc', `%fixed_output_files', `%defines', `%no_parser', `%verbose',
1080 `%debug', `%source_extension' and `%header_extension'.
1081
1082** @$
1083 Automatic location tracking.
1084\f
1085* Changes in version 1.28, 1999-07-06:
1086
1087** Should compile better now with K&R compilers.
1088
1089** Added NLS.
1090
1091** Fixed a problem with escaping the double quote character.
1092
1093** There is now a FAQ.
1094\f
1095* Changes in version 1.27:
1096
1097** The make rule which prevented bison.simple from being created on
1098 some systems has been fixed.
1099\f
1100* Changes in version 1.26:
1101
1102** Bison now uses automake.
1103
1104** New mailing lists: <bug-bison@gnu.org> and <help-bison@gnu.org>.
1105
1106** Token numbers now start at 257 as previously documented, not 258.
1107
1108** Bison honors the TMPDIR environment variable.
1109
1110** A couple of buffer overruns have been fixed.
1111
1112** Problems when closing files should now be reported.
1113
1114** Generated parsers should now work even on operating systems which do
1115 not provide alloca().
1116\f
1117* Changes in version 1.25, 1995-10-16:
1118
1119** Errors in the input grammar are not fatal; Bison keeps reading
1120the grammar file, and reports all the errors found in it.
1121
1122** Tokens can now be specified as multiple-character strings: for
1123example, you could use "<=" for a token which looks like <=, instead
1124of chosing a name like LESSEQ.
1125
1126** The %token_table declaration says to write a table of tokens (names
1127and numbers) into the parser file. The yylex function can use this
1128table to recognize multiple-character string tokens, or for other
1129purposes.
1130
1131** The %no_lines declaration says not to generate any #line preprocessor
1132directives in the parser file.
1133
1134** The %raw declaration says to use internal Bison token numbers, not
1135Yacc-compatible token numbers, when token names are defined as macros.
1136
1137** The --no-parser option produces the parser tables without including
1138the parser engine; a project can now use its own parser engine.
1139The actions go into a separate file called NAME.act, in the form of
1140a switch statement body.
1141\f
1142* Changes in version 1.23:
1143
1144The user can define YYPARSE_PARAM as the name of an argument to be
1145passed into yyparse. The argument should have type void *. It should
1146actually point to an object. Grammar actions can access the variable
1147by casting it to the proper pointer type.
1148
1149Line numbers in output file corrected.
1150\f
1151* Changes in version 1.22:
1152
1153--help option added.
1154\f
1155* Changes in version 1.20:
1156
1157Output file does not redefine const for C++.
1158
1159Local Variables:
1160mode: outline
1161End:
1162
1163-----
1164
1165Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
11662004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation,
1167Inc.
1168
1169This file is part of Bison, the GNU Parser Generator.
1170
1171This program is free software: you can redistribute it and/or modify
1172it under the terms of the GNU General Public License as published by
1173the Free Software Foundation, either version 3 of the License, or
1174(at your option) any later version.
1175
1176This program is distributed in the hope that it will be useful,
1177but WITHOUT ANY WARRANTY; without even the implied warranty of
1178MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1179GNU General Public License for more details.
1180
1181You should have received a copy of the GNU General Public License
1182along with this program. If not, see <http://www.gnu.org/licenses/>.