summaryrefslogtreecommitdiff
path: root/examples
Commit message (Collapse)AuthorAgeFilesLines
...
* d: create alias Symbol for YYParse.SymbolAdela Vais2020-12-212-20/+20
| | | | | | | * data/skeletons/lalr1.d: Here. * doc/bison.texi: Document it. * examples/d/calc/calc.y, examples/d/simple/calc.y: Adjust. * tests/calc.at, tests/d.at, tests/scanner.at: Test it.
* glr2.cc: example: use objects (not pointers) to represent the ASTAkim Demaille2020-12-204-74/+119
| | | | | | | | | | | | | | | | | | | | | | 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: example: use streams and accept argumentsAkim Demaille2020-12-201-26/+63
| | | | | | | | | | From a debugger, it is easier to pass a file name than working on stdin. * examples/c++/glr/c++-types.yy: Reduce scopes. Avoid YYSTYPE/YYLTYPE: use the C++ types. (input, process): New. (main): Use them.
* glr2.cc: example: style: add missing copyright headersAkim Demaille2020-12-193-2/+38
| | | | | * examples/c++/glr/ast.hh, examples/c++/glr/c++-types.yy: here. * examples/c++/glr/local.mk: Fix distribution of ast.hh.
* glr2.cc: example: address Clang warningsAkim Demaille2020-12-191-8/+18
| | | | | | | | | | | | | | | | | ast.hh:24:7: error: 'Node' has no out-of-line virtual method definitions; its vtable will be emitted in every translation unit [-Werror,-Wweak-vtables] class Node ^ ast.hh:57:7: error: 'Nterm' has no out-of-line virtual method definitions; its vtable will be emitted in every translation unit [-Werror,-Wweak-vtables] class Nterm : public Node ^ ast.hh:102:7: error: 'Term' has no out-of-line virtual method definitions; its vtable will be emitted in every translation unit [-Werror,-Wweak-vtables] class Term : public Node ^ * examples/c++/glr/ast.hh: Define the destructors out of the class definition. This does not change anything, it is still in the header, but that does pacify clang.
* glr2.cc: make the example more C++Akim Demaille2020-12-143-121/+124
| | | | | | | | | | Currently the example really looks like C. Instead of a union of structs to implement the AST, use a hierarchy. It would be nice to feature a C++17 version with std variants. * examples/c++/glr/c++-types.yy (Node, free_node, new_nterm) (new_term): Move into... * examples/c++/glr/ast.hh: here, a proper C++ hierarchy.
* glr2.cc: fix pointer arithmethicsAkim Demaille2020-12-141-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* d: change YYLocation's type from class to structAdela Vais2020-11-201-9/+9
| | | | | | | | | | | | | This avoids heap allocation and gives minimal costs for the creation and destruction of the YYParser.Symbol struct if the location tracking is active. Suggested by H. S. Teoh. * data/skeletons/lalr1.d: Here. * doc/bison.texi: Document it. * examples/d/calc/calc.y: Adjust. * tests/calc.at: Test it.
* d: change the return value of yylex from TokenKind to YYParser.SymbolAdela Vais2020-11-202-21/+20
| | | | | | | | | | | | | | The complete symbol approach was deemed to be the right approach for Dlang. Now, the user can return from yylex() an instance of YYParser.Symbol structure, which binds together the TokenKind, the semantic value and the location. Before, the last two were reported separately to the parser. Only the user API is changed, Bisons's internal structure is kept the same. * data/skeletons/d.m4 (struct YYParser.Symbol): New. * data/skeletons/lalr1.d: Change the return value. * doc/bison.texi: Document it. * examples/d/calc/calc.y, examples/d/simple/calc.y: Demonstrate it. * tests/calc.at, tests/scanner.at: Test it.
* examples: avoid "unbound variable" errorsMartin Rehak2020-11-201-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.
* style: comment and formatting changes, and fixesAkim Demaille2020-11-081-4/+4
| | | | | | | * examples/c/lexcalc/parse.y: Fix option handling. * src/gram.h: Clarify comments. * src/ielr.c: Fix indentation. * src/print.c, src/state.h: More comments.
* d: add the custom error message featureAdela Vais2020-11-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Parser.Context class returns a const YYLocation, so Lexer's method yyerror() needs to receive the location as a const parameter. Internal error reporting flow is changed to be similar to that of the other skeletons. Before, case YYERRLAB was calling yyerror() with the result of yysyntax_error() as the string parameter. As the custom error message lets the user decide if they want to use yyerror() or not, this flow needed to be changed. Now, case YYERRLAB calls yyreportSyntaxError(), that builds the error message using yysyntaxErrorArguments(). Then yyreportSyntaxError() passes the error message to the user defined syntax_error() in case of a custom message, or to yyerror() otherwise. In the tests in tests/calc.at, the order of the tokens needs to be changed in order of precedence, so that the D program outputs the expected tokens in the same order as the other parsers. * data/skeletons/lalr1.d: Add the custom error message feature. * doc/bison.texi: Document it. * examples/d/calc/calc.y: Adjust. * tests/calc.at, tests/local.at: Test it.
* d: examples: fix coding styleAdela Vais2020-11-072-22/+22
| | | | | * examples/d/calc/calc.y, examples/d/simple/calc.y: Fix whitespace issues and remove the @property attribute.
* d: add yyerrokAdela Vais2020-11-072-2/+2
| | | | | | | | | In D's case, yyerrok() is a private method of the Parser class. It can be called directly as `yyerrok()` from the grammar rules section. * data/skeletons/lalr1.d: Add yyerrok(). * examples/d/calc/calc.y, examples/d/simple/calc.y: Demonstrate yyerrok(). * tests/calc.at: Update D tests to use yyerrok().
* java: avoid Integer(String), use parseIntAkim Demaille2020-11-032-2/+2
| | | | | | | | | examples/java/calc/Calc.java:1531: warning: [deprecation] Integer(String) in Integer has been deprecated yylval = new Integer(st.sval); ^ * examples/java/calc/Calc.y, examples/java/simple/Calc.y, * tests/calc.at, tests/scanner.at: Use Integer.parseInt.
* java: add support for lookahead correctionAkim Demaille2020-11-031-1/+7
| | | | | | | | | | Shamelessly stolen from Adrian Vogelsgesang's implementation in lalr1.cc. * data/skeletons/lalr1.java (yycdebugNnl, yyLacCheck, yyLacEstablish) (yyLacDiscard, yylacStack, yylacEstablished): New. (Context): Use it. * examples/java/calc/Calc.y: Enable LAC.
* style: comment changes in the skeletonsAkim Demaille2020-11-031-3/+3
| | | | | * data/skeletons/lalr1.cc: Prepare for Java's LAC. * data/skeletons/lalr1.java: Style fixes.
* Merge branch 'maint'Akim Demaille2020-10-141-0/+7
|\ | | | | | | | | | | | | | | | | | | | | * upstream/maint: doc: fix typo maint: post-release administrivia version 3.7.3 build: don't link bison against libreadline gnulib: update glr.cc: fix: use symbol_name build: fix a concurrent build issue in examples
| * build: fix a concurrent build issue in examplesAkim Demaille2020-09-061-0/+7
| | | | | | | | | | | | | | Reported by Thomas Deutschmann <whissi@gentoo.org>. https://lists.gnu.org/r/bug-bison/2020-09/msg00010.html * examples/c/lexcalc/local.mk: scan.o depends on parse.[ch].
* | multistart: also give access to yynerrsAkim Demaille2020-09-273-16/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is something that has always bothered me: with pure parsers (and they all should be) the user does not have an (easy) access to yynerrs at the end of the parse. In the case of error recovery, that's the only direct means to know if there were errors. The usual approach being having the user maintain a counter incremented each time yyerror is called. So here, also capture yynerrs in the return value of the start-symbol parsing functions. * data/skeletons/yacc.c (yy_parse_impl_t): New. (yy_parse_impl): Use it. (b4_accept): Fill it. * examples/c/lexcalc/parse.y, examples/c/lexcalc/scan.l: No longer pass nerrs as lex- and parse-param, just use the resulting yynerrs. bistromathic and reccalc both demonstrate %param.
* | multistart: allow tokens as start symbolsAkim Demaille2020-09-271-1/+1
| | | | | | | | | | | | | | | | | | After all, why not? * src/reader.c (switching_token): Use symbol_id_get. (check_start_symbols): Require that the start symbol is a token only if it's the only one. * examples/c/lexcalc/parse.y: Let NUM be a start symbol.
* | multistart: use b4_accept instead of action post-processingAkim Demaille2020-09-272-14/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | multistart: toy with it in lexcalcAkim Demaille2020-09-272-2/+39
| | | | | | | | | | * examples/c/lexcalc/parse.y: Define several start symbols. * examples/c/lexcalc/lexcalc.test: Check support.
* | glr2.cc: add an exampleAkim Demaille2020-09-268-3/+412
| | | | | | | | | | | | | | | | | | | | Currently this example crashes on input such as "T (x) + y;". The same example with glr.c works properly. * examples/c++/glr/Makefile, examples/c++/glr/README.md, * examples/c++/glr/c++-types.test, examples/c++/glr/c++-types.yy, * examples/c++/glr/local.mk, examples/c++/local.mk: New. Based on examples/c/glr/c++-types.y.
* | d: change the return value of yylex from int to TokenKindAdela Vais2020-09-262-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | * 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.
* | examples: add a demonstration of GLR parsers in CAkim Demaille2020-09-196-0/+432
| | | | | | | | | | | | | | | | | | Based on the test case 668 (cxx-type.at:437) "GLR: Merge conflicting parses, pure, locations". * examples/c/glr/Makefile, examples/c/glr/README.md, * examples/c/glr/c++-types.test, examples/c/glr/c++-types.y, * examples/c/glr/local.mk: New.
* | options: rename --defines as --headerAkim Demaille2020-09-195-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The name "defines" is incorrect, the generated file contains far more than just #defines. * src/getargs.h, src/getargs.c (-H, --header): New option. With optional argument, just like --defines, --xml, etc. (defines_flag): Rename as... (header_flag): this. Adjust dependencies. * data/skeletons/bison.m4, data/skeletons/c.m4, data/skeletons/glr.c, * data/skeletons/glr.cc, data/skeletons/glr2.cc, data/skeletons/lalr1.cc, * data/skeletons/yacc.c: Adjust. * examples, doc/bison.texi: Adjust. * tests/headers.at, tests/local.at, tests/output.at: Convert most tests from using --defines to using --header.
* | examples: d: remove unused tokenAkim Demaille2020-09-072-6/+2
| | | | | | | | * examples/d/calc/calc.y, examples/d/simple/calc.y: Remove "=".
* | doc: simplify the extraction of example snippetsAkim Demaille2020-09-051-8/+10
| | | | | | | | | | * doc/bison.texi: Use qualified paths. * examples/extexi: Comment changes.
* | examples: d: demonstrate location trackingAdela Vais2020-09-033-10/+60
| | | | | | | | | | * examples/d/calc/calc.y: Track locations. * examples/d/calc/calc.test: Check locations.
* | examples: d: duplicate the example as "simple" and "calc"Adela Vais2020-09-0310-20/+296
| | | | | | | | | | | | * examples/d/Makefile, examples/d/calc.d, examples/d/calc.test, examples/d/calc/local.mk: Move into... * examples/d/calc, examples/d/simple: these new directories.
* | examples: d: fix the handling of unary +Adela Vais2020-09-022-1/+11
|/ | | | | | | It was interpreting "+exp" as "-exp". * examples/d/calc.y: Fix. * examples/d/calc.test: Check it.
* build: beware of POSIX modeAkim Demaille2020-08-303-3/+3
| | | | | | | | | Reported by Dennis Clarke. https://lists.gnu.org/r/bug-bison/2020-08/msg00013.html * examples/d/local.mk, examples/java/calc/local.mk, * examples/java/simple/local.mk: Pass bison's options before its argument, in case we're in POSIX mode.
* fix: crash when redefining the EOF tokenAkim Demaille2020-08-071-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reported by Agency for Defense Development. https://lists.gnu.org/r/bug-bison/2020-08/msg00008.html On an empty such as %token FOO BAR FOO 0 %% input: %empty we crash because when we find FOO 0, we decrement ntokens (since FOO was discovered to be EOF, which is already known to be a token, so we increment ntokens for it, and need to cancel this). This "works well" when EOF is properly defined in one go, but here it is first defined and later only assign token code 0. In the meanwhile BAR was given the token number that we just decremented. To fix this, assign symbol numbers after parsing, not during parsing, so that we also saw all the explicit token codes. To maintain the current numbers (I'd like to keep no difference in the output, not just equivalence), we need to make sure the symbols are numbered in the same order: that of appearance in the source file. So we need the locations to be correct, which was almost the case, except for nterms that appeared several times as LHS (i.e., several times as "foo: ..."). Fixing the use of location_of_lhs sufficed (it appears it was intended for this use, but its implementation was unfinished: it was always set to "false" only). * src/symtab.c (symbol_location_as_lhs_set): Update location_of_lhs. (symbol_code_set): Remove broken hack that decremented ntokens. (symbol_class_set, dummy_symbol_get): Don't set number, ntokens and nnterms. (symbol_check_defined): Do it. (symbols): Don't count nsyms here. Actually, don't count nsyms at all: let it be done in... * src/reader.c (check_and_convert_grammar): here. Define nsyms from ntokens and nnterms after parsing. * tests/input.at (EOF redeclared): New. * examples/c/bistromathic/bistromathic.test: Adjust the traces: in "%nterm <double> exp %% input: ...", exp used to be numbered before input.
* bistromathic: demonstrate caret-diagnosticsAkim Demaille2020-07-114-11/+75
| | | | | | | * examples/c/bistromathic/parse.y (user_context): We need the current line. (yyreport_syntax_error): Quote the guilty line, with squiggles. * examples/c/bistromathic/bistromathic.test: Adjust.
* bistromathic: do not display parse errors on completionAkim Demaille2020-07-112-16/+36
| | | | | | | | | | | | | Currently autocompletion on a line with errors leaks the error messages. It can be useful to let the user know, but GNU Readline does not provide us with an nice way to display the error. So we actually break into the current line of the user. So instead, do not show these errors. * examples/c/bistromathic/parse.y (user_context): New. Use %param to pass it to the parser and scanner. Keep quiet when in computing autocompletion.
* bistromathic: don't stupidly reset the location for each tokenAkim Demaille2020-07-112-4/+4
| | | | | | | | That quite defeats the whole point of locations... But anyway, we should not see these messages at all. * examples/c/bistromathic/parse.y (expected_tokens): Fix (useless) location tracking.
* bistromathic: promote yytoken_kind_tAkim Demaille2020-07-111-6/+7
| | | | * examples/c/bistromathic/parse.y: Use yytoken_kind_t rather than int.
* examples: add license headersAkim Demaille2020-07-089-1/+172
| | | | | | | | | | | | | Prompted by Rici Lake. https://stackoverflow.com/questions/62658368/#comment110853985_62661621 Discussed with Paul Eggert. * doc/bison.texi, examples/c/bistromathic/parse.y, * examples/c/lexcalc/parse.y, examples/c/lexcalc/scan.l, * examples/c/pushcalc/calc.y, examples/c/reccalc/parse.y, * examples/c/reccalc/scan.l, examples/d/calc.y, * examples/java/calc/Calc.y, examples/java/simple/Calc.y: Install the GPL3+ header.
* examples: include the generated headerAkim Demaille2020-07-053-3/+28
| | | | | | | | | * examples/c/bistromathic/parse.y, examples/c/lexcalc/parse.y, * examples/c/reccalc/parse.y: here. Add some comments. * src/parse-gram.y (api_version): Pull out of handle_require. Bump to 3.7.
* package: fix syntax-check errorsAkim Demaille2020-07-041-1/+1
| | | | * examples/c/bistromathic/bistromathic.test, po/POTFILES.in: here.
* yacc.c: push: don't clear the parser state when accepting/rejectingAkim Demaille2020-06-292-10/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently when a push parser finishes its parsing (i.e., it did not return YYPUSH_MORE), it also clears its state. It is therefore impossible to see if it had parse errors. In the context of autocompletion, because error recovery might have fired, the parser is actually already in a different state. For instance on `(1 + + <TAB>` in the bistromathic, because there's a `exp: "(" error ")"` recovery rule, `1 + +` tokens have already been popped, replaced by `error`, and autocompletions think we are ready for the closing ")". So here, we would like to see if there was a syntax error, yet `yynerrs` was cleared. In the case of a successful parse, we still have a problem: if error recovery succeeded, we won't know it, since, again, `yynerrs` is clearer. It seems much more natural to leave the parser state available for analysis when there is a failure. To reuse the parser, we should either: 1. provide an explicit means to reinitialize a parser state for future parses. 2. automatically reset the parser state when it is used in a new parse. Option 2 requires to check whether we need to reinitialize the parser each time we call `yypush_parse`, i.e., each time we give a new token. This seems expensive compared to Option 1, but benchmarks revealed no difference. Option 1 is incompatible with the documentation ("After `yypush_parse` returns a status other than `YYPUSH_MORE`, the parser instance `yyps` may be reused for a new parse."). So Option 2 wins, reusing the private `yynew` member to record that a parse was finished, and therefore that the state must reset in the next call to `yypull_parse`. While at it, this implementation now reuses the previously enlarged stacks from one parse to another. * data/skeletons/yacc.c (yypstate_new): Set up the stacks in their initial configurations (setting their bottom to the stack array), and use yypstate_clear to reset them (moving their top to their bottom). (yypstate_delete): Adjust. (yypush_parse): At the beginning, clear yypstate if needed, and at the end, record when yypstate needs to be clearer. * examples/c/bistromathic/parse.y (expected_tokens): Do not propose autocompletion when there are parse errors. * examples/c/bistromathic/bistromathic.test: Check that case.
* bistromathic: don't display undefined locationsAkim Demaille2020-06-292-1/+15
| | | | | | | | | Currently, completion when there is a syntax error shows broken locations. * examples/c/bistromathic/parse.y (expected_tokens): Initialize the location. * examples/c/bistromathic/bistromathic.test: Check that.
* examples: fix missing includesAkim Demaille2020-06-061-4/+4
| | | | | * examples/c/bistromathic/parse.y: Use abort rather than assert so that the "unused result" warning is silenced even with -DNDEBUG.
* Merge maint into HEADAkim Demaille2020-06-0313-25/+47
|\ | | | | | | | | | | | | | | | | * upstream/maint: maint: post-release administrivia version 3.6.3 build: check -Wmissing-prototypes tests: show logs c++: fix printing of state number on streams
| * build: check -Wmissing-prototypesAkim Demaille2020-06-0113-23/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | pstate_clear is lacking a prototype. Reported by Ryan https://lists.gnu.org/r/bug-bison/2020-05/msg00101.html Besides, none of the C examples were compiled with the warning flags. * configure.ac (warn_c): Add -Wmissing-prototypes. * data/skeletons/yacc.c (pstate_clear): Make it static. * examples/local.mk (TEST_CFLAGS): New. * examples/c/bistromathic/local.mk, examples/c/calc/local.mk, * examples/c/lexcalc/local.mk, examples/c/mfcalc/local.mk, * examples/c/pushcalc/local.mk, examples/c/reccalc/local.mk, * examples/c/rpcalc/local.mk: Use it. GCC's warn_unused_result is not silenced by a cast to void, so we have to "use" scanf's result. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25509 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66425 Flex generated code produces too many warnings, including things such as, with ICC: examples/c/lexcalc/scan.c(1088): error #1682: implicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem) 2259 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), 2260 ^ 2261 2262 I am tired of trying to fix Flex's output. The project does not seem maintained. We ought to avoid it. So, for the time being, don't try to enable warnings with Flex. * examples/c/bistromathic/parse.y, examples/c/reccalc/scan.l: Fix warnings. * doc/bison.texi: Discard scanf's return value to defeat -Werror=unused-result.
| * tests: show logsAkim Demaille2020-05-232-4/+5
| | | | | | | | * examples/c/bistromathic/bistromathic.test, examples/test: here.
| * examples: use markdown hyperlinksAkim Demaille2020-05-143-11/+11
| | | | | | | | | | * examples/c++/README.md, examples/c++/calc++/README.md, * examples/c/README.md: here.
* | tests: show logsAkim Demaille2020-05-232-4/+5
| | | | | | | | * examples/c/bistromathic/bistromathic.test, examples/test: here.
* | examples: don't promote unchecked function callsAkim Demaille2020-05-163-5/+10
| | | | | | | | | | | | | | | | * etc/bench.pl.in, examples/c/bistromathic/parse.y, * examples/c/calc/calc.y, examples/c/pushcalc/calc.y: Check scanf's return value. * doc/bison.texi: Likewise, but only for the second example, to avoid cluttering the very simple case.