summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* version 3.7.6v3.7.6Akim Demaille2021-03-081-1/+1
| | | | * NEWS: Record release date.
* doc: don't mention YY_LOCATION_PRINTAkim Demaille2021-03-071-1/+1
| | | | | * doc/bison.texi (Syntax Error Reporting Function): Don't refer to YY_LOCATION_PRINT, it is a private internal detail.
* yacc: fix push parserAkim Demaille2021-03-073-8/+139
| | | | | | | | | | | | | | When a pstate is used for multiple successive parses, some state may leak from one run into the following one. That was introduced in 330552ea499ca474f65967160e9d4e50265f9631 "yacc.c: push: don't clear the parser state when accepting/rejecting". Reported by Ryan <dev@splintermail.com> https://lists.gnu.org/r/bug-bison/2021-03/msg00000.html * data/skeletons/yacc.c (yypush_parse): We reusing a pstate from a previous run, do behave as if it were the first run. * tests/push.at (Pstate reuse): Check this.
* tables: fix again the handling of useless tokensAkim Demaille2021-03-072-5/+16
| | | | | | | | | | | The right-shift added in c22902e360e0fbbe9fd5657dcf107e03166da309 ("tables: fix handling for useless tokens") is incorrect. In particular, we need to reset the "new" bits. Reported by Balázs Scheidler. https://github.com/akimd/bison/issues/74 * src/tables.c (pos_set_set): Fix the right-shift.
* Update URLs to prefer https: to http:Paul Eggert2021-01-30222-535/+533
| | | | Also, fix a few http: URLs that were no longer working.
* doc: fix typoAkim Demaille2021-01-241-3/+4
| | | | | | | Reported by Kaz Kylheku. https://lists.gnu.org/r/bison-patches/2020-11/msg00019.html * doc/bison.texi (Versioning): here.
* doc: document best deployment practices.Kaz Kylheku2021-01-241-0/+66
| | | | | * doc/bison.texi (Versioning): New node about practices regarding dealing with multiple versions of Bison.
* maint: post-release administriviaAkim Demaille2021-01-242-1/+4
| | | | | | * NEWS: Add header line for next release. * .prev-version: Record previous version. * cfg.mk (old_NEWS_hash): Auto-update.
* version 3.7.5v3.7.5Akim Demaille2021-01-241-1/+1
| | | | * NEWS: Record release date.
* tables: fix handling for useless tokensAkim Demaille2021-01-242-11/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In some rare conditions, the generated parser can be wrong when there are useless tokens. Reported by Balázs Scheidler. https://github.com/akimd/bison/issues/72 Balázs managed to prove that the bug was introduced in commit af1c6f973a60a51c609903713ff8f7fce0887025 Author: Theophile Ranquet <ranquet@lrde.epita.fr> Date: Tue Nov 13 10:38:49 2012 +0000 tables: use bitsets for a performance boost Suggested by Yuri at <http://lists.gnu.org/archive/html/bison-patches/2012-01/msg00000.html>. The improvement is marginal for most grammars, but notable for large grammars (e.g., PosgreSQL's postgre.y), and very large for the sample.y grammar submitted by Yuri in http://lists.gnu.org/archive/html/bison-patches/2012-01/msg00012.html. Measured with --trace=time -fsyntax-only. parser action tables postgre.y sample.y Before 0,129 (44%) 37,095 (99%) After 0,117 (42%) 5,046 (93%) * src/tables.c (pos): Replace this set of integer coded as an unsorted array of integers with... (pos_set): this bitset. which was implemented long ago, but that I installed only recently (March 2019), first published in v3.3.90. That patch introduces a bitset to represent a set of integers. It managed negative integers by using a (fixed) base (the smallest integer to represent). It avoided negative accesses into the bitset by ignoring integers smaller than the base, under the asumption that these cases correspond to useless tokens that are ignored anyway. While it turns out to be true for all the test cases in the test suite (!), Balázs' use case demonstrates that it is not always the case. So we need to be able to accept negative integers that are smaller than the current base. "Amusingly" enough, the aforementioned patch was visibly unsure about itself: /* Store PLACE into POS_SET. PLACE might not belong to the set of possible values for instance with useless tokens. It would be more satisfying to eliminate the need for this 'if'. */ This commit needs several improvements in the future: - support from bitset for bit assignment and shifts - amortized resizing of pos_set - test cases * src/tables.c (pos_set_base, pos_set_dump, pos_set_set, pos_set_test): New. Use them instead of using bitset_set and bitset_test directly.
* cex: fix state-item pruningVincent Imbimbo2021-01-242-37/+26
| | | | | | | | | | | | | | | | | | | | | | There were several bugs in pruning that would leave the state-item graph in an inconsistent state which could cause crashes later on: - Pruning now happens in one pass instead of two. - Disabled state-items no longer prune the state-items they transition to if that state-item has other states that transition to it. - State-items that transition to disabled state-items are always pruned even if they have productions. Reported by Michal Bartkowiak <michal.bartkowiak@nokia.com> https://lists.gnu.org/r/bug-bison/2021-01/msg00000.html and Zartaj Majeed https://github.com/akimd/bison/issues/71 * src/state-item.c (prune_forward, prune_backward): Fuse into... (prune_state_item): this. Adjust callers.
* package: pacify syntax-checkAkim Demaille2021-01-231-0/+1
| | | | | | | * cfg.mk: Currently we cannot update gnulib because of portability issues with ancient versions of clang (https://lists.gnu.org/r/bug-gnulib/2021-01/msg00241.html). So skip the check about copyright date for gnulib.
* news: updateAkim Demaille2021-01-231-0/+9
|
* package: bump copyrights to 2021Akim Demaille2021-01-23241-259/+259
| | | | Run 'make update-copyright'.
* %merge: associate it to its first definition, not the latestAkim Demaille2021-01-232-14/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently each time we meet %merge we record this location as the defining location (and symbol). Instead, record the first definition. In the generated code we go from yy0->A = merge (*yy0, *yy1); to yy0->S = merge (*yy0, *yy1); where S was indeed the first symbol, and in the diagnostics we go from glr-regr18.y:30.18-24: error: result type clash on merge function 'merge': <type2> != <type1> 30 | sym2: sym3 %merge<merge> { $$ = $1; } ; | ^~~~~~~ glr-regr18.y:29.18-24: note: previous declaration 29 | sym1: sym2 %merge<merge> { $$ = $1; } ; | ^~~~~~~ glr-regr18.y:31.13-19: error: result type clash on merge function 'merge': <type3> != <type2> 31 | sym3: %merge<merge> { $$ = 0; } ; | ^~~~~~~ glr-regr18.y:30.18-24: note: previous declaration 30 | sym2: sym3 %merge<merge> { $$ = $1; } ; | ^~~~~~~ to glr-regr18.y:30.18-24: error: result type clash on merge function 'merge': <type2> != <type1> 30 | sym2: sym3 %merge<merge> { $$ = $1; } ; | ^~~~~~~ glr-regr18.y:29.18-24: note: previous declaration 29 | sym1: sym2 %merge<merge> { $$ = $1; } ; | ^~~~~~~ glr-regr18.y:31.13-19: error: result type clash on merge function 'merge': <type3> != <type1> 31 | sym3: %merge<merge> { $$ = 0; } ; | ^~~~~~~ glr-regr18.y:29.18-24: note: previous declaration 29 | sym1: sym2 %merge<merge> { $$ = $1; } ; | ^~~~~~~ where both duplicates are reported against definition 1, rather than using definition 1 as a reference when diagnosing about definition 2, and then 2 as a reference for 3. * src/reader.c (record_merge_function_type): Keep the first definition. * tests/glr-regression.at: Adjust.
* %merge: fix compatibility with api.value.type=unionAkim Demaille2021-01-231-1/+1
| | | | | | | | | | | Reported by Jot Dot. https://lists.gnu.org/r/help-bison/2020-12/msg00014.html * data/skeletons/glr.c, data/skeletons/glr2.cc (b4_call_merger): Use the symbol's slot, not its type. * examples/c/glr/c++-types.y: Use explicit per-symbol typing together with api.value.type=union. (yylex): Use yytoken_kind_t.
* %merge: delegate the generation of calls to mergers to m4Akim Demaille2021-01-232-7/+12
| | | | | | | Don't generate C code from bison, leave that to the skeletons. * src/output.c (merger_output): Emit invocations to b4_call_merger. * data/skeletons/glr.c (b4_call_merger): New.
* %merge: let mergers record a typing-symbol, rather than a typeAkim Demaille2021-01-233-23/+25
| | | | | | | | | | | | Symbols are richer than types, and in M4 it is my simpler (and more common) to deal with symbols rather than types. So let's associate mergers to a symbol rather than a type name. * src/reader.h (merger_list): Replace the 'type' member by a symbol member. * src/reader.c (record_merge_function_type): Take a symbol as argument, rather than a type name. * src/output.c (merger_output): Adjust.
* %merge: clearer tests on diagnosticsAkim Demaille2021-01-231-1/+9
| | | | * tests/glr-regression.at: Use caret errors.
* skeletons: introduce "slot"s for symbolsAkim Demaille2021-01-232-1/+21
| | | | | | | | Extracted from d9cf99b6a5cb0345e91dfb90fe6d6473024ea97a, in the master branch. * data/skeletons/bison.m4 (b4_symbol_slot): New, with safer semantics than type and type_tag.
* style: YYUSE is private, make it YY_USEAkim Demaille2021-01-2311-39/+39
| | | | | | | | | | This macro is not exposed to users, make start it with 'YY_'. * data/skeletons/bison.m4, data/skeletons/c.m4, data/skeletons/glr.c, * data/skeletons/glr.cc, data/skeletons/lalr1.cc, * src/parse-gram.c, tests/actions.at, tests/c++.at, tests/headers.at, * tests/local.at (YYUSE): Rename as... (YY_USE): this.
* package: codespellAkim Demaille2021-01-232-2/+3
| | | | * src/parse-gram.y: Fix spelling.
* cex: fix traces: fix display of disabled itemsAkim Demaille2021-01-232-23/+300
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The display of disabled state items is incorrect. The item is stuttered, and lacks on end-of-line. From State 7: 1 exp: exp • "⊕" exp -> 1 exp: exp "⊕" • exp <- 1 exp: • exp "⊕" exp 2 exp: exp • "+" exp 2 exp: exp • "+" exp DISABLED 2 exp: exp "+" exp • <- 2 exp: exp "+" • exp 3 exp: exp • "+" exp 3 exp: exp • "+" exp DISABLED 3 exp: exp "+" exp • <- 3 exp: exp "+" • exp to State 7: 1 exp: exp • "⊕" exp -> 1 exp: exp "⊕" • exp <- 1 exp: • exp "⊕" exp 2 exp: exp • "+" exp DISABLED 2 exp: exp "+" exp • <- 2 exp: exp "+" • exp 3 exp: exp • "+" exp DISABLED 3 exp: exp "+" exp • <- 3 exp: exp "+" • exp * src/state-item.c (state_items_report): Don't issue disabled items twice, and issue two '\n' at their end. * tests/conflicts.at: Check it.
* cex: fix traces: add missing end-of-linesAkim Demaille2021-01-232-4/+6
| | | | | | | | In 430ca0fc632f5e8072fe468b8a99c640985f6926, I completely forgot that `puts` adds a `\n`. * src/lssi.c, src/state-item.c: Restore missing end-of-lines in the output.
* cex: add support for $TIME_LIMITAkim Demaille2021-01-232-4/+17
| | | | | | | * src/counterexample.c (TIME_LIMIT): Replace with... (time_limit): this. (counterexample_init): Check $TIME_LIMIT. * src/scan-gram.l: Reorder includes.
* cex: send traces to stderr, not stdoutAkim Demaille2021-01-232-24/+23
| | | | | | | When comparing traces from different machines, the mixture of stdout/stderr in the output are making things uselessly difficult. * src/lssi.c, src/state-item.c: Output debug traces on stderr.
* c++: I'm tired of Flex's warningsAkim Demaille2021-01-231-0/+8
| | | | | * doc/bison.texi: Disable another warning I'm tired to see. New releases would be most welcome.
* glr.cc: don't "leak" yyparseAkim Demaille2021-01-232-3/+3
| | | | | | | | When using glr.cc, the C function yyparse is an internal detail that should not be exposed. Users might call it by accident (I did). * data/skeletons/glr.c (yyparse): When used for glr.cc, rename as yy_parse_impl. * data/skeletons/glr.cc: Adjust.
* tables: avoid warnings and save bitsAkim Demaille2021-01-234-10/+29
| | | | | | | | | | | | | | | | The yydefgoto table uses -1 as an invalid for an impossible case (we never use yydefgoto[0], since it corresponds to the reduction to $accept, which never happens). Since yydefgoto is a table of state numbers, this -1 forces a signed type uselessly, which (1) might trigger compiler warnings when storing a value from yydefgoto into a state number (nonnegative), and (2) wastes bits which might result in using a int16 where a uint8 suffices. Reported by Jot Dot <jotdot@shaw.ca>. https://lists.gnu.org/r/bug-bison/2020-11/msg00027.html * src/tables.c (default_goto): Use 0 rather than -1 as invalid value. * tests/regression.at: Adjust.
* c++: use noexcept where appropriateAkim Demaille2021-01-232-6/+6
| | | | | | | | Reported by Don Macpherson. https://github.com/akimd/bison/issues/63 https://github.com/akimd/bison/issues/64 * data/skeletons/c++.m4, data/skeletons/lalr1.cc: here.
* examples: avoid "unbound variable" errorsMartin Rehak2021-01-231-0/+1
| | | | | | | | When the shell option `nounset` is set, we may get "unbound variable" errors. https://lists.gnu.org/r/bug-bison/2020-11/msg00013.html * examples/test (diff_opts): Be sure to initialize it.
* autoconf: updateAkim Demaille2021-01-231-0/+0
|
* c: adjust _Noreturn to pedantic clangAkim Demaille2021-01-231-7/+9
| | | | | | | | | | Reported by Joe Nelson <joe@begriffs.com>. https://lists.gnu.org/r/help-bison/2021-01/msg00004.html Fixed by Paul Eggert in gnulib. https://lists.gnu.org/r/bug-gnulib/2021-01/msg00156.html * data/skeletons/c.m4 (b4_attribute_define): Adjust _Noreturn to pedantic clang.
* c: port to HP-UX 11.23Paul Eggert2021-01-212-0/+15
| | | | | | | Problem reported by Albert Chin in: https://lists.gnu.org/r/bug-bison/2021-01/msg00029.html * data/skeletons/c.m4 (b4_c99_int_type_define): Work around HP-UX bug.
* maint: post-release administriviaAkim Demaille2020-11-142-1/+4
| | | | | | * NEWS: Add header line for next release. * .prev-version: Record previous version. * cfg.mk (old_NEWS_hash): Auto-update.
* version 3.7.4v3.7.4Akim Demaille2020-11-141-1/+1
| | | | * NEWS: Record release date.
* c++: shorten the assertions that check whether tokens are correctAkim Demaille2020-11-132-6/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | Before: YY_ASSERT (tok == token::YYEOF || tok == token::YYerror || tok == token::YYUNDEF || tok == 120 || tok == 49 || tok == 50 || tok == 51 || tok == 52 || tok == 53 || tok == 54 || tok == 55 || tok == 56 || tok == 57 || tok == 97 || tok == 98); After: YY_ASSERT (tok == token::YYEOF || (token::YYerror <= tok && tok <= token::YYUNDEF) || tok == 120 || (49 <= tok && tok <= 57) || (97 <= tok && tok <= 98)); Clauses are now also wrapped on several lines. This is nicer to read and diff, but also avoids pushing Visual C++ to its arbitrary limits (640K and lines of 16380 bytes ought to be enough for anybody, otherwise make an C2026 error). The useless parens are there for the dummy warnings about precedence (in the future, will we also have to put parens in `1+2*3`?). * data/skeletons/variant.hh (_b4_filter_tokens, b4_tok_in, b4_tok_in): New. (_b4_token_constructor_define): Use them.
* c++: don't glue functions togetherAkim Demaille2020-11-132-5/+6
| | | | | | * data/skeletons/bison.m4 (b4_type_foreach): Accept a separator. * data/skeletons/c++.m4: Use it. And fix an incorrect comment.
* lalr1.cc: YY_ASSERT should use api.prefixAkim Demaille2020-11-134-29/+57
| | | | | | | | | | | | | | | | | | Working on the previous commit I realized that YY_ASSERT was used in the generated headers, so must follow api.prefix to avoid clashes when multiple C++ parser with variants are used. Actually many more macros should obey api.prefix (YY_CPLUSPLUS, YY_COPY, etc.). There was no complaint so far, so it's not urgent enough for 3.7.4, but it should be addressed in 3.8. * data/skeletons/variant.hh (b4_assert): New. Use it. * tests/local.at (AT_YYLEX_RETURN): Fix. * tests/headers.at: Make sure variant-based C++ parsers are checked too. This test did find that YY_ASSERT escaped renaming (before the fix in this commit).
* c++: don't use YY_ASSERT at all if parse.assert is disabledAkim Demaille2020-11-132-10/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In some extreme situations (about 800 tokens), we generate a single-line assertion long enough for Visual C++ to discard the end of the line, thus falling into parse ends for the missing `);`. On a shorter example: YY_ASSERT (tok == token::TOK_YYEOF || tok == token::TOK_YYerror || tok == token::TOK_YYUNDEF || tok == token::TOK_ASSIGN || tok == token::TOK_MINUS || tok == token::TOK_PLUS || tok == token::TOK_STAR || tok == token::TOK_SLASH || tok == token::TOK_LPAREN || tok == token::TOK_RPAREN); Whether NDEBUG is used or not is irrelevant, the parser dies anyway. Reported by Jot Dot <jotdot@shaw.ca>. https://lists.gnu.org/r/bug-bison/2020-11/msg00002.html We should avoid emitting lines so long. We probably should also use a range-based assertion (with extraneous parens to pacify fascist compilers): YY_ASSERT ((token::TOK_YYEOF <= tok && tok <= token::TOK_YYUNDEF) || (token::TOK_ASSIGN <= tok && ...) But anyway, we should simply not emit this assertion at all when not asked for. * data/skeletons/variant.hh: Do not define, nor use, YY_ASSERT when it is not enabled.
* c++: style: follow the Bison m4 quoting patternAkim Demaille2020-11-131-12/+12
| | | | * data/skeletons/variant.hh: here.
* yacc.c: provide the Bison version as an integral macroAkim Demaille2020-11-119-17/+30
| | | | | | | | | | | | Suggested by Balazs Scheidler. https://github.com/akimd/bison/issues/55 * src/muscle-tab.c (muscle_init): Move/rename `b4_version` to/as... * src/output.c (prepare): `b4_version_string`. Also define `b4_version`. * data/skeletons/bison.m4, data/skeletons/c.m4, data/skeletons/d.m4, * data/skeletons/java.m4: Adjust. * doc/bison.texi: Document it.
* regenAkim Demaille2020-11-112-64/+18
|
* style: make conversion of version string to int publicAkim Demaille2020-11-114-48/+99
| | | | | | * src/parse-gram.y (str_to_version): Rename as/move to... * src/strversion.h, src/strversion.c (strversion_to_int): these new files.
* %require: accept version numbers with three parts ("3.7.4")Akim Demaille2020-11-114-34/+64
| | | | | | * src/parse-gram.y (str_to_version): Support three parts. * data/skeletons/location.cc, data/skeletons/stack.hh: Adjust.
* yacc.c: fix #definition of YYEMPTYTodd C. Miller2020-11-112-3/+8
| | | | | | | | | When generating a C parser, YYEMPTY is present in enum yytokentype but there is no corresponding #define like there is for the other values. There is a special case for YYEMPTY in b4_token_enums but no corresponding case in b4_token_defines. * data/skeletons/c.m4 (b4_token_defines): Do define YYEMPTY.
* gnulib: updateAkim Demaille2020-11-101-0/+0
|
* doc: fix incorrect section titleAkim Demaille2020-11-011-4/+4
| | | | | | | | Reported by Gaurav Singh <gaurav.singh199709@yahoo.com>. https://lists.gnu.org/r/bug-bison/2020-11/msg00000.html * doc/bison.texi (Rpcalc Expr): Rename as... (Rpcalc Exp): this, as the nterm is named 'exp'.
* doc: minor grammar fixes in counterexamples sectionNick Gasson2020-10-281-5/+6
| | | | * doc/bison.texi: Minor fixes in counterexamples section.
* doc: fix typoAkim Demaille2020-10-141-1/+1
| | | | * README: here.