summaryrefslogtreecommitdiff
path: root/TODO
Commit message (Collapse)AuthorAgeFilesLines
* package: bump copyrights to 2022Paul Eggert2022-01-151-1/+1
| | | | Run "make update-copyright".
* build: check -Wsubobject-linkage in C++Akim Demaille2021-10-111-0/+4
| | | | * configure.ac (warn_cxx): here.
* tests: disable "Multistart reports"Akim Demaille2021-09-021-0/+1
| | | | | | | | | For some reason this test fails on Solaris/x86. But multistart is not part of 3.8, so we can postpone the debugging of this issue. Reported by Dagobert Michelsen. <https://lists.gnu.org/r/bug-bison/2021-08/msg00027.html> * tests/report.at (Multistart reports): Comment out.
* CI: don't require Autoconf 2.71Akim Demaille2021-08-191-0/+2
|
* examples: don't demonstrate multistart, which is not part of 3.8Akim Demaille2021-08-191-3/+0
| | | | | | | | | Besides, for mysterious reasons, this fails on some environment. Reported by Dagobert Michelsen. <https://lists.gnu.org/archive/html/bug-bison/2021-08/msg00008.html> * examples/c/lexcalc/lexcalc.test, examples/c/lexcalc/parse.y, * examples/c/lexcalc/scan.l: Revert to a single-start example.
* glr2.cc: require C++11Akim Demaille2021-08-191-1/+4
| | | | | | | | | | | | | | Reported by Dagobert Michelsen. https://lists.gnu.org/r/bug-bison/2021-08/msg00006.html * m4/bison-cxx-std.m4 (_BISON_CXXSTD_98_snippet): We don't need vector::data, it was only for glr2.cc, which is C++11 anyway. (_BISON_CXXSTD_11_snippet): We need vector::data and std::swap on arrays. * m4/cxx.m4 (BISON_TEST_FOR_WORKING_CXX_COMPILER): We don't need vector::data. * tests/local.at (AT_COMPILE_CXX): Skip when glr2.cc and no support for C++11.
* glr.c: fix signature when using custom error messagesAkim Demaille2021-08-111-0/+2
| | | | | | | Reported by Tom Shields <thomas.evans.shields@icloud.com>. * data/skeletons/glr.c (yypcontext_location): Fix return type. * tests/calc.at: Check the case pure, location, custom error messages.
* tests: check symbol/token renumberingAkim Demaille2021-08-111-8/+0
| | | | | | | | | In some extreme situations, with lots of useless tokens, Bison was numbering them incorrectly, which resulted in a broken grammar. <https://lists.gnu.org/r/bison-patches/2021-03/msg00001.html> commit a774839ca873d1082f79ba3c4eecc1e242a28ce1. * tests/regression.at (Useless Tokens): New.
* yacc: comply with recent POSIX updates: declare yyerror and yylexAkim Demaille2021-08-091-4/+0
| | | | | | | | | | | | | | | | | | | | | In POSIX Yacc mode, declare yyerror and yylex unless already #defined, or if YYERROR_IS_DECLARED/YYLEX_IS_DECLARED are defined (for consistency with Bison's YYSTYPE_IS_DECLARED/YYLTYPE_IS_DECLARED). See <https://austingroupbugs.net/view.php?id=1388#c5220>. * data/skeletons/c.m4 (b4_function_declare): Resurect. (b4_lex_formals): Since we will possibly expose this prototype in the header, take the prefix into account. * data/skeletons/yacc.c (b4_declare_yyerror_and_yylex): New. (b4_shared_declarations): Use it. * tests/local.at (AT_YACC_IF): New. When in Yacc mode, set the `yacc` Autotest keyword. (AT_YYERROR_DECLARE(c)): Don't declare in Yacc mode, to avoid clashes (since this signature is static). (AT_YYERROR_DEFINE(c)): Don't define as static in Yacc mode. * tests/regression.at (Early token definitions with --yacc): Specify that we are in Yacc mode.
* m4: catch suspicions of unevaluated macrosAkim Demaille2021-08-071-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Check in m4's output if there are sequences such as m4_foo or b4_foo, which are probably resulting from incorrect m4 processing. It actually already is useful: - it caught a leaking b4_lac_if leaking from glr.c, where LAC is not supported, hence b4_lac_if is not defined. - it also caught references to location.hh in position.hh when location.hh does not exist. - while making "Code injection" robust to these new warnings (it is its very purpose to let b4_canary pass unevaluated), I saw that it did not check lalr1.d, and when adding lalr1.d, it revealed it did underquote ocurrences of token value types. * src/scan-skel.l (macro): New abbreviation. Use it. * data/skeletons/glr.c: Don't use b4_lac_if, we don't have it. * data/skeletons/location.cc: Don't generate position.hh when we don't generate location.hh. * data/skeletons/d.m4 (b4_basic_symbol_constructor_define): Fix underquotation. * data/skeletons/bison.m4 (b4_canary): New. * tests/input.at (Code injection): Use it, and check lalr1.d too.
* style: formatting changes in scan-code.lAkim Demaille2021-08-071-0/+8
| | | | * src/scan-code.l: Fix indentation.
* doc: avoid #define YYDEBUG in C++Akim Demaille2021-08-071-3/+0
| | | | * doc/bison.texi (Enabling Traces): here.
* todo: d: push and token ctors are doneAkim Demaille2021-08-041-96/+0
|
* doc: glr: document typed mergersAkim Demaille2021-08-041-9/+0
| | | | | | | See <https://lists.gnu.org/r/help-bison/2020-12/msg00016.html>. * doc/bison.texi (Merging GLR Parses): document typed mergers. And avoid #define YYSTYPE.
* todo: POSIX yacc and prototypesAkim Demaille2021-08-031-0/+4
|
* doc: printing locationsAkim Demaille2021-02-091-4/+0
| | | | | | Document YYLOCATION_PRINT. * doc/bison.texi (Printing Locations): New node.
* yacc: remove support for YYPRINTAkim Demaille2021-02-011-4/+1
| | | | | | | | | Its removal was annonced several times in NEWS (for Bison 3.5, 3.6, 3.7). * data/skeletons/c.m4, data/skeletons/yacc.c: Remove support for YYPRINT. * NEWS: Fix the mess introduced by the merge. Document the removal of YYPRINT. * doc/bison.texi (The YYPRINT Macro): Remove.
* c++: make it clear that #define YYSTYPE is not supportedAkim Demaille2021-02-011-4/+1
| | | | | | | | We have been accepting this for years, but it is deprecated: people are expecting to define api.value.type instead. * doc/bison.texi: Make it clear that YYSTYPE and YYLTYPE are for C only.
* Update URLs to prefer https: to http:Paul Eggert2021-01-291-2/+2
| | | | Also, fix a few http: URLs that were no longer working.
* package: fix details after merge with 3.7.5Akim Demaille2021-01-241-0/+22
| | | | | * TODO, cfg.mk: Update. * src/parse-gram.c, src/parse-gram.h: Regen.
* package: bump copyrights to 2021Akim Demaille2021-01-161-1/+1
| | | | Run 'make update-copyright'.
* glr2.cc: add support for api.token.constructorAkim Demaille2021-01-101-5/+0
| | | | | | | * data/skeletons/glr2.cc: Add support for api.token.constructor. * examples/c++/glr/c++-types.yy: Use it. * examples/c++/glr/c++-types.test: Adjust expectations for error messages.
* glr.c: example: several improvementsAkim Demaille2021-01-021-0/+4
| | | | | | | | | * examples/c/glr/c++-types.y (node_print): New. Use YY_LOCATION_PRINT instead of duplicating it. And actually use it in the action instead of badly duplicating it. (main): Add proper option support. * examples/c/glr/c++-types.test: Adjust expectations on locations. * examples/c++/glr/c++-types.yy: Fix bad iteration.
* %merge: fix compatibility with api.value.type=unionAkim Demaille2020-12-311-0/+9
| | | | | | | | | | | 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.
* style: use yyval only, not yysvalAkim Demaille2020-12-261-7/+1
| | | | | * data/skeletons/glr.c, data/skeletons/glr2.cc: Use yyval, as in the other skeletons.
* style: rename semanticVal as valueAkim Demaille2020-12-261-1/+1
| | | | | | | | * data/skeletons/README-D.txt: Remove, now useless and obsolete. * data/skeletons/glr2.cc, examples/d/calc/calc.y, * tests/calc.at, tests/d.at, tests/scanner.at (semanticVal): Replace with... (value): this.
* glr2.cc: use YYCDEBUG, not YY_DEBUG_STREAMAkim Demaille2020-12-261-1/+0
| | | | | * data/skeletons/glr2.cc (YY_DEBUG_STREAM): Rename as... (YYCDEBUG): this, as in lalr1.cc.
* glr2.cc: don't use YYSTYPE/YYLTYPE at allAkim Demaille2020-12-261-4/+0
| | | | | | * data/skeletons/glr2.cc: Define value_type and location_type where needed, and use them only. (yyuserMerge): Make it a member function of the glr_state class.
* glr2.cc: example: use objects (not pointers) to represent the ASTAkim Demaille2020-12-201-0/+17
| | | | | | | | | | | | | | | | | | | | | | Currently we are using pointers. The whole point of glr2.cc (vs. glr.cc) is precisely to allow genuine C++ objects to be semantic values. Let's make that work. * data/skeletons/glr2.cc (glr_state::glr_state): Be sure to initialize yysval. (glr_state): Add copy-ctor, assignment and dtor. (glr_state::copyFrom): Be sure to initialize the destination if it was not. (glr_state::~glr_state): Destroy the semantic value. * examples/c++/glr/ast.hh: Rewrite so that we use genuine objects, rather than a traditional OOP hierarchy that requires to deal with pointers. With help from Bruno Belanyi <bruno.belanyi@epita.fr>. * examples/c++/glr/c++-types.yy: Remove memory management. Use true objects. (main): Don't reach yydebug directly. * examples/c++/glr/local.mk: We need C++11.
* glr2.cc: fix pointer arithmethicsAkim Demaille2020-12-141-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | A glr_state keeps tracks of its predecessor using an offset relative to itself (i.e., pointer subtraction). Unfortunately we sometimes have to compute offsets for pointers that live in different containers, in particular in yyfillin. In that case there is no reason for the distance between the two objects to be a multiple of the object size (0x40 on my machine), and the resulting ptrdiff_t may be "wrong", i.e., it does allow to recover one from the other. We cannot use "typed" pointer arithmetics here, the Euclidean division has it wrong. So use "plain" char* pointers. Fixes 718 (Duplicate representation of merged trees: glr2.cc) and examples/c++/glr/c++-types. Still XFAIL: 712: Improper handling of embedded actions and dollar(-N) in GLR parsers: glr2.cc 730: Incorrectly initialized location for empty right-hand side in GLR: glr2.cc 748: Incorrect lookahead during nondeterministic GLR: glr2.cc * data/skeletons/glr2.cc (glr_state::as_pointer_): New. (glr_state::pred): Use it. * examples/c++/glr/c++-types.test: The test passes. * tests/glr-regression.at (Duplicate representation of merged trees: glr2.cc): Passes.
* glr2.cc: add support for parse.assertAkim Demaille2020-12-061-0/+4
| | | | | * data/skeletons/glr2.cc: Fake support of parse.assert, so that the tests can use it without failing.
* glr2.cc: turn some pointers into referencesAkim Demaille2020-12-061-0/+6
| | | | | * data/skeletons/glr2.cc: Prefer references to pointers. Add a few more const.
* glr.c: fix line numbers in logsAkim Demaille2020-12-061-0/+6
| | | | | * data/skeletons/glr.c (yyglrReduce): Fix line numbers. * tests/glr-regression.at: Fix expectations.
* gnulib: updateAkim Demaille2020-11-301-8/+0
|
* TODO: updateAkim Demaille2020-11-221-68/+5
|
* todo: moreAkim Demaille2020-11-111-0/+4
|
* multistart: introduce and use rule_is_initialAkim Demaille2020-11-101-19/+0
| | | | | | | * src/gram.h (rule_is_initial): New. * src/graphviz.c, src/print-xml.c, src/print.c, src/lalr.c: Use it. Some of these occurrences were incorrect (checking whether this is rule 0), and not behaving properly in the case of multistart.
* java: lac: a stronger test for the exploratory stackAkim Demaille2020-11-061-0/+3
| | | | | | * tests/local.at (AT_YYLEX_DEFINE(java)): Fix overquoting issue. Style changes. * tests/regression.at (LAC: Exploratory stack): Run for lalr1.java too.
* tests: remove useless prefix for EOF in DAkim Demaille2020-09-291-0/+3
| | | | | | * tests/calc.at (CALC_EOF): Rename as... (EOF): this. Since there is no risk of a clash with #define EOF here...
* yacc.c: also count calls to YYERROR in yynerrsAkim Demaille2020-09-271-0/+3
| | | | * data/skeletons/yacc.c: here.
* multistart: use b4_accept instead of action post-processingAkim Demaille2020-09-271-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For each start symbol, generate a parsing function with a richer return value than the usual of yyparse. Reserve a place for the returned semantic value, in order to avoid having to pass a pointer as argument to "return" that value. This also makes the call to the parsing function independent of whether a given start-symbol is typed. For instance, if the grammar file contains: %type <int> expression %start input expression (so "input" is valueless) we get typedef struct { int yystatus; } yyparse_input_t; yyparse_input_t yyparse_input (void); typedef struct { int yyvalue; int yystatus; } yyparse_expression_t; yyparse_expression_t yyparse_expression (void); This commit also changes the implementation of the parser termination: when there are multiple start symbols, it is the initial rules that explicitly YYACCEPT. They do that after having exported the start-symbol's value (if it is typed): switch (yyn) { case 1: /* $accept: YY_EXPRESSION expression $end */ { ((*yyvalue).TOK_expression) = (yyvsp[-1].TOK_expression); YYACCEPT; } break; case 2: /* $accept: YY_INPUT input $end */ { YYACCEPT; } break; I have tried several ways to deal with termination, and this is the one that appears the best one to me. It is also the most natural. * src/scan-code.h, src/scan-code.l (obstack_for_actions): New. * src/reader.c (grammar_rule_check_and_complete): Generate the actions of the rules for each start symbol. * data/skeletons/bison.m4 (b4_symbol_slot): New, with safer semantics than type and type_tag. * data/skeletons/yacc.c (b4_accept): New. Generates the body of the action of the start rules. (_b4_declare_sub_yyparse): For each start symbol define a dedicated return type for its parsing function. Adjust the declaration of its parsing function. (_b4_define_sub_yyparse): Adjust the definition of the function. * examples/c/lexcalc/parse.y: Check the case of valueless symbols. * examples/c/lexcalc/lexcalc.test: Check start symbols.
* todo: moreAkim Demaille2020-09-271-0/+19
|
* multistart: equip yacc.cAkim Demaille2020-09-271-0/+4
| | | | * data/skeletons/yacc.c: Add support for multiple start symbols.
* multistart: turn start symbols into rules on $acceptAkim Demaille2020-09-271-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now that the parser can read several start symbols, let's process them, and create the corresponding rules. * src/parse-gram.y (grammar_declaration): Accept a list of start symbols. * src/reader.h, src/reader.c (grammar_start_symbol_set): Rename as... (grammar_start_symbols_set): this. * src/reader.h, src/reader.c (start_flag): Replace with... (start_symbols): this. * src/reader.c (grammar_start_symbols_set): Build a list of start symbols. (switching_token, create_start_rules): New. (check_and_convert_grammar): Use them to turn the list of start symbols into a set of rules. * src/reduce.c (nonterminals_reduce): Don't complain about $accept, it's an internal detail. (reduce_grammar): Complain about all the start symbols that don't derive sentences. * src/symtab.c (startsymbol, startsymbol_loc): Remove, replaced by start_symbols. symbols_pack): Move the check about the start symbols to... * src/symlist.c (check_start_symbols): here. Adjust to multiple start symbols. * tests/reduce.at (Empty Language): Generalize into... (Bad start symbols): this.
* d: change the return value of yylex from int to TokenKindAdela Vais2020-09-261-11/+4
| | | | | | | | | | | | * data/skeletons/lalr1.d: Change the return value. * examples/d/calc/calc.y, examples/d/simple/calc.y: Adjust. * tests/scanner.at: Adjust. * tests/calc.at (_AT_DATA_CALC_Y(d)): New, extracted from... (_AT_DATA_CALC_Y(c)): here. The two grammars have been sufficiently different to be separated. Still trying to be them together results in a maintenance burden. For the same reason, instead of specifying the results for D and for the rest, compute the expected results with D from the regular case.
* glr2.cc: disable incorrect warnings from GCC6 to 9Akim Demaille2020-09-131-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For instance with GCC8: 616. regression.at:1560: testing Lex and parse params: glr2.cc ... tests/regression.at:1560: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y tests/regression.at:1560: $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o input input.cc $LIBS stderr: input.cc: In member function 'YYRESULTTAG glr_stack::yyresolveValue(glr_state*)': input.cc:1796:10: error: potential null pointer dereference [-Werror=null-dereference] return yypred ? &(asItem(this) - yypred)->getState() : YY_NULLPTR; ^~~~~~ input.cc:1796:10: error: potential null pointer dereference [-Werror=null-dereference] return yypred ? &(asItem(this) - yypred)->getState() : YY_NULLPTR; ^~~~~~ cc1plus: all warnings being treated as errors It complains that the implicit this in yypred might be null. It fears it because of loops such as for (glr_state* yys = firstTopState(); yys != yystateStack.yysplitPoint; yys = yys->pred()) yyn += 1; that could possibly set yys to null, since yys->pred might return null. However, the warning is incorrect, since in C++ `this` cannot be null. GCC 10 no longer emits this warning. GCC 7 also complains many times about glr_stack::yyresolveLocations when NDEBUG is enabled (when it is not, YYASSERT (yyoption != YY_NULLPTR) is probably enough to pacify GCC): 616. regression.at:1560: testing Lex and parse params: glr2.cc ... tests/regression.at:1560: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y tests/regression.at:1560: $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o input input.cc $LIBS stderr: input.cc: In member function 'void glr_stack::yyresolveLocations(glr_state*, int)': input.cc:3061:46: error: potential null pointer dereference [-Werror=null-dereference] yyrhsloc[0].getState().yyloc = yyoption->state()->yyloc; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ input.cc:3061:46: error: potential null pointer dereference [-Werror=null-dereference] yyrhsloc[0].getState().yyloc = yyoption->state()->yyloc; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ input.cc:3061:46: error: potential null pointer dereference [-Werror=null-dereference] yyrhsloc[0].getState().yyloc = yyoption->state()->yyloc; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ input.cc: In member function 'YYRESULTTAG glr_stack::yyresolveValue(glr_state*)': input.cc:3061:46: error: potential null pointer dereference [-Werror=null-dereference] yyrhsloc[0].getState().yyloc = yyoption->state()->yyloc; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ input.cc:3061:46: error: potential null pointer dereference [-Werror=null-dereference] yyrhsloc[0].getState().yyloc = yyoption->state()->yyloc; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ input.cc:3061:46: error: potential null pointer dereference [-Werror=null-dereference] yyrhsloc[0].getState().yyloc = yyoption->state()->yyloc; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ input.cc:3061:46: error: potential null pointer dereference [-Werror=null-dereference] yyrhsloc[0].getState().yyloc = yyoption->state()->yyloc; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ input.cc:3061:46: error: potential null pointer dereference [-Werror=null-dereference] yyrhsloc[0].getState().yyloc = yyoption->state()->yyloc; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ input.cc:3061:46: error: potential null pointer dereference [-Werror=null-dereference] yyrhsloc[0].getState().yyloc = yyoption->state()->yyloc; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ * data/skeletons/glr2.cc (YY_IGNORE_NULL_DEREFERENCE_BEGIN) (YY_IGNORE_NULL_DEREFERENCE_BEGIN): New. (glr_state::pred, glr_stack::yyresolveLocations): Use them.
* d: make enum SymbolKind idiomatic DAdela Vais2020-09-121-84/+0
| | | | | | | | Taking into account comments from H. S. Teoh. https://lists.gnu.org/r/bison-patches/2020-09/msg00021.html * data/skeletons/d.m4, data/skeletons/lalr1.d (SymbolKind): Wrap the enum in a structure that contains its string representation.
* glr2.cc: move StrongIndexAlias into the namespaceValentin Tolmer2020-09-121-4/+0
| | | | * data/skeletons/glr2.cc: here.
* glr2.cc: remove usage of PTRDIFF_MAXValentin Tolmer2020-09-121-12/+0
| | | | * data/skeletons/glr2.cc: Use std::ptrdiff_t and numeric_limits.
* glr2.cc: remove C-style castsValentin Tolmer2020-09-121-8/+0
| | | | * data/skeletons/glr2.cc: here.