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