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