Commit Graph

719 Commits

Author SHA1 Message Date
Akim Demaille
85d303b713 examples: sort them per language and complete them
Convert some of the READMEs to Markdown, which is now more common, and
nicely displayed in some git hosting services.

Add missing READMEs and Makefiles.  Generate XML, HTML and Dot files.  Be
sure to ship the test files.  Complete CLEANFILES to remove all generated
files.

* examples/calc++: Move into...
* examples/c++: here.
* examples/mfcalc, examples/rpcalc: Move into...
* examples/c: here.

* examples/README.md, examples/c++/calc++/Makefile, examples/c/local.mk,
* examples/c/mfcalc/Makefile, examples/c/rpcalc/Makefile,
* examples/d/README.md, examples/java/README.md:
New files.

* examples/test (medir): Be robust to deeper directory nesting.
2018-12-09 13:55:05 +01:00
Akim Demaille
d527b2d0f1 NEWS: update 2018-12-03 06:00:07 +01:00
Akim Demaille
7d823c505e NEWS: update 2018-12-01 17:29:04 +01:00
Akim Demaille
ad0b4661d1 %expect-rr: fix the computation of the overall number of conflicts
On a grammar such as

   exp: "num" | "num" | "num"

we currently report only one RR conflict, instead of two.

This bug is present since the origins of Bison

    commit 08089d5d35
    Author: David MacKenzie <djm@djmnet.org>
    Date:   Tue Apr 20 05:42:52 1993 +0000

       Initial revision

and was preserved in

    commit 676385e29c
    Author: Paul Hilfinger <Hilfinger@CS.Berkeley.EDU>
    Date:   Fri Jun 28 02:26:44 2002 +0000

       Initial check-in introducing experimental GLR parsing.  See entry in
       ChangeLog dated 2002-06-27 from Paul Hilfinger for details.

See
https://lists.gnu.org/archive/html/bison-patches/2018-11/msg00011.html

* src/conflicts.h, src/conflicts.c (count_state_rr_conflicts)
(count_rr_conflicts): Use only the correct count of conflicts.
* tests/glr-regression.at: Fix expectations.
2018-11-22 08:34:07 +01:00
Akim Demaille
487a2a9eca NEWS: update 2018-11-21 22:05:45 +01:00
Akim Demaille
35b8e0e947 parser: deprecate %error-verbose
It is unfortunate that %error_verbose was properly diagnosed as
obsoleted by "%define parse.error verbose", but %error-verbose was
not.

* src/parse-gram.y (%error-verbose): Remove support.
* src/scan-gram.l: Do it here instead, with a warning.
* tests/input.at (Deprecated directives): Check it.
2018-11-12 07:41:46 +01:00
Akim Demaille
7928c3e6fb parser: deprecate %nterm
It has several weaknesses.
Reported by Rici Lake.
http://lists.gnu.org/archive/html/bug-bison/2018-10/msg00000.html

* src/scan-gram.l: here.
2018-11-12 07:28:20 +01:00
Akim Demaille
7823c65ee9 NEWS: expected features of Bison 3.3 2018-11-11 08:57:55 +01:00
Akim Demaille
c239e53bab djgpp: remove
Support for DJGPP was announced to be removed in the NEWS of Bison
3.1 (2018-08-27) unless someone expressed interest.  There was no answer.

* djgpp: Remove.
* NEWS, Makefile.am, cfg.mk, po/POTFILES.in: Adjust.
2018-11-10 17:02:50 +01:00
Akim Demaille
a91873a1b9 maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2018-11-09 06:51:46 +01:00
Akim Demaille
b590ad0292 version 3.2.1
* NEWS: Record release date.
2018-11-09 06:34:16 +01:00
Akim Demaille
351e3630bb NEWS: update 2018-11-06 13:26:41 +01:00
Akim Demaille
50fac71d46 maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2018-10-29 21:15:10 +01:00
Akim Demaille
a8455b072a version 3.2
* NEWS: Record release date.
2018-10-29 20:37:13 +01:00
Akim Demaille
1664d1c5ed NEWS: prepare for 3.2 2018-10-27 08:30:50 +02:00
Akim Demaille
8fd5f0d5a5 examples: move the variant examples into the C++ directory
* examples/variant-11.test examples/variant-11.yy,
* examples/variant.test examples/variant.yy:
Move into examples/c++/.
* examples/c++/README: New.
* examples/README, examples/c++/local.mk, examples/local.mk:
Adjust.
2018-10-24 07:20:08 +02:00
Akim Demaille
f9bba892bd c++: make operator() an alias to the parse function
* data/glr.cc, data/lalr1.cc (operator()): New.
* doc/bison.texi: Update.
2018-10-24 06:18:57 +02:00
Akim Demaille
73917e9e6f all: display a clear warning about private macros
* data/bison.m4 (b4_disclaimer): New.
* data/glr.c, data/glr.cc, data/lalr1.cc, data/yacc.c: Use it.
2018-10-22 07:28:54 +02:00
Akim Demaille
83a832618d maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2018-10-18 13:33:28 +02:00
Akim Demaille
0e0d7d2975 version 3.1.91
* NEWS: Record release date.
2018-10-18 12:54:37 +02:00
Akim Demaille
5abbc66fe4 NEWS: update 2018-10-18 12:54:08 +02:00
Akim Demaille
f5fc21240f maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2018-10-17 07:11:56 +02:00
Akim Demaille
ebddc0a0d2 version 3.1.90
* NEWS: Record release date.
2018-10-17 06:32:48 +02:00
Akim Demaille
ea31f21fd8 C++: let %require "3.2" disable the generation of obsolete files
The files stack.hh and position.hh are deprecated.  Rather than
devoting specify %define variables to discard them (api.position.file
and api.stack.file), and rather than having to use special rules when
api.location.file is used, let's simply decide that from %require
"3.2" onwards, these files will not be generated.

The only noticeable thing here is that, in order to be able to check
the behavior of %require "3.2", to have this version (which is still
3.1-*) to accept %require "3.2".

* src/gram.h, src/gram.c (required_version): New.
* src/parse-gram.y (version_check): Set it.
* src/output.c (prepare): Pass it m4.
* data/bison.m4 (b4_required_version_if): Receive it and use it.
* data/location.cc, data/stack.hh: Replace the api.*.file with only
required version comparison.
* tests/input.at: No longer check api.stack.file and api.position.file.
* NEWS, doc/bison.texi: Don't mention them.
Document the %require 3.2 behavior.
* tests/output.at: Use %require 3.2 instead.
2018-10-16 13:33:32 +02:00
Akim Demaille
c69944ff8b doc: do not advertise %nterm
Reported by Rici Lake.
http://lists.gnu.org/archive/html/bug-bison/2018-10/msg00000.html

* NEWS, doc/bison.texi: here.
2018-10-15 19:23:49 +02:00
Akim Demaille
01898726e2 generate the default semantic action
Currently, in C, the default semantic action is implemented by being
always run before running the actual user semantic action.  As a
consequence, when the user action is run, $$ is already set as $1.

In C++ with variants, we don't do that, since we cannot manipulate the
semantic value without knowing its exact type.  When variants are
enabled, the only guarantee is that $$ is default contructed and ready
to the used.

Some users still would like the default action to be run with
variants.  Frank Heckenbach's parser in
C++17 (http://lists.gnu.org/archive/html/bug-bison/2018-04/msg00011.html)
provides this feature, but relying on std::variant's dynamic typing,
which we forbid in lalr1.cc.

The simplest seems to be actually generating the default semantic
action (in all languages/skeletons).  This makes the pre-action (that
sets $$ to $1) useless.  But...  maybe some users depend on this, in
spite of the comments that clearly warn againt this.  So let's not
turn this off just yet.

* src/reader.c (grammar_rule_check_and_complete): Rename as...
(grammar_rule_check_and_complete): this.
Install the default semantic action when applicable.
* examples/variant-11.yy, examples/variant.yy, tests/calc.at:
Exercise the default semantic action, even with variants.
2018-10-14 18:53:21 +02:00
Akim Demaille
fa264a0687 NEWS: document api.*.file changes 2018-10-07 08:12:49 +02:00
Akim Demaille
878dc0a172 news: c++: move semantics 2018-09-22 14:52:13 +02:00
Akim Demaille
bbfa419b89 style: use midrule only, not mid-rule
The code was already using midrule only, never mid_rule.  This is
simpler to remember, and matches a similar change we made from
look-ahead to lookahead.

* NEWS, doc/bison.texi, src/reader.c, src/scan-code.h, src/scan-code.l
* tests/actions.at, tests/c++.at, tests/existing.at: here.
2018-09-19 22:09:53 +02:00
Akim Demaille
b476c143c0 maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2018-08-27 22:30:02 +02:00
Akim Demaille
2caaeba496 version 3.1
* NEWS: Record release date.
2018-08-27 21:52:23 +02:00
Akim Demaille
55947367c6 NEWS: update 2018-08-24 19:48:19 +02:00
Akim Demaille
44e76d801f lalr1.cc: support compilation with disabled support for exceptions
Reported by Brooks Moses <bmoses@google.com>
http://lists.gnu.org/archive/html/bison-patches/2018-02/msg00000.html

* data/lalr1.cc (YY_EXCEPTIONS): New.
Use it to disable try/catch clauses.

* doc/bison.texi (C++ Parser Interface): Document it.

* configure.ac (CXXFLAGS_NO_EXCEPTIONS): New.
* tests/atlocal.in: Receive it.
* tests/local.at (AT_FULL_COMPILE, AT_LANG_COMPILE):
Accept a new argument, extra compiler flags.
* tests/calc.at: Run the C++ calculator with exception support disabled.
2018-08-19 17:47:59 +02:00
Akim Demaille
5010af94d0 portability: don't use _Pragma with ICC
ICC defines __GNUC__ [1], but does not support GCC's _Pragma for
diagnostics.  As a matter of fact, I believe it does not support
_Pragma at all (only #pragma) [2].

Reported by Maxim Prohorenko.
https://savannah.gnu.org/support/index.php?108339

[1] https://software.intel.com/en-us/cpp-compiler-18.0-developer-guide-and-reference-gcc-compatibility-and-interoperability
[2] https://software.intel.com/en-us/cpp-compiler-18.0-developer-guide-and-reference-pragmas

* data/c.m4 (YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN): Exclude ICC from
the club.
2018-08-18 14:15:13 +02:00
Akim Demaille
adf0425d11 escape properly the file names in #line for printer/destructor
Reported by Jannick.
http://lists.gnu.org/archive/html/bug-bison/2017-05/msg00001.html

"Amusingly" enough, we have the same problem with %defines when the
parser file name has backslashes or quotes: we generate #includes with
an incorrect C string.

* src/output.c (prepare_symbol_definitions): Escape properly the file
names before passing them to M4.
* data/bison.m4, data/lalr1.cc: Don't simply put the file name between
two quotes (that should have been strong enough a smell...), expect
the string to be properly quoted.
* tests/synclines.at: New tests to check this.
2018-08-18 10:04:50 +02:00
Akim Demaille
9c80fa286e NEWS: update 2018-08-11 18:09:29 +02:00
Akim Demaille
70875b4873 doc: we now show the type of the symbols
* doc/bison.texi (Understanding Your Parser): Update the output
from Bison.
Use types in the example, and show them in the report.
* NEWS: Update.
2018-06-22 09:51:32 +02:00
Akim Demaille
f462a08572 Merge maint into master
* upstream/maint: (48 commits)
  THANKS: update an address
  tests: adjust syncline tests to GCC 7
  glr: fix improperly placed synclines
  bison: be git grep friendly
  Replace ftp with https
  maint: post-release administrivia
  version 3.0.5
  bison: style: indentation fixes
  regen
  bison: please address sanitizer
  C++: style: fix indentation
  NEWS: update
  C++: style: prefer `unsigned` to `unsigned int`
  C++: style: space before paren
  C++: fix -Wdeprecated warnings
  tests: fix -Wdeprecated warning
  maint: update syntax-check exclusions
  autoconf: update
  regen
  Update copyright years
  ...
2018-06-17 18:43:59 +02:00
Akim Demaille
38d91ccd96 maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2018-05-27 14:42:55 +02:00
Akim Demaille
0dfa650f59 version 3.0.5
* NEWS: Record release date.
2018-05-27 11:53:43 +02:00
Akim Demaille
1047f3c095 NEWS: update 2018-05-27 10:04:11 +02:00
Akim Demaille
2e9e591889 Update copyright years
Run `make update-copyright`.
2018-05-12 18:18:41 +02:00
Paul Eggert
96748b2bf8 Capitalize "Polish" when it's a proper adjective 2017-09-22 09:10:04 -07:00
Akim Demaille
476c1cca59 lalr1, yacc: use the default location as initial error location
Currently lalr1.cc makes an out-of-bound access when trying to read @1
in rules with an empty rhs (i.e., when there is no @1) that raises an
error (YYERROR).

glr.c already gracefully handles this by using @$ as initial location
for the errors.  Let's do that in yacc.c and lalr1.cc.

* data/lalr1.cc, data/yacc.c: Use @$ to initialize the error location.
* tests/actions.at: Check that case.
2015-08-12 13:56:07 +02:00
Akim Demaille
d6445ec10b Merge remote-tracking branch 'origin/maint'
* origin/maint:
  maint: post-release administrivia
  version 3.0.4
  gnulib: update
  build: re-enable compiler warnings, and fix them
  tests: c++: fix a C++03 conformance issue
  tests: fix a title
  c++: reserve 200 slots in the parser's stack
  tests: be more robust to unrecognized synclines, and try to recognize xlc
  tests: fix C++ conformance
  build: fix some warnings
  build: avoid infinite recursions on include_next
2015-01-23 15:17:35 +01:00
Akim Demaille
7ca7a3abf3 maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2015-01-23 14:13:40 +01:00
Akim Demaille
c4e686a1ab version 3.0.4
* NEWS: Record release date.
2015-01-23 13:53:53 +01:00
Akim Demaille
658b189348 tests: c++: fix a C++03 conformance issue
This fixes test 241 on xLC:

"input.y", line 42.11: 1540-0274 (S) The name lookup for "report" did not find a declaration.
"input.y", line 42.11: 1540-1292 (I) Static declarations are not considered for a function call if the function is not qualified.

where report is:

  static void
  report (std::ostream& yyo, int ival, float fval)
  {
    yyo << "ival: " << ival << ", fval: " <<  fval;
  }

and line 42 is:

  %printer { report (yyo, $$,       $<fval>$); } <ival>;

It turns out that indeed this function must not be declared static,
<http://stackoverflow.com/a/17662745/1353549>.  Let's put it into an
anonymous namespace.

Reported by Thomas Jahns.
http://lists.gnu.org/archive/html/bug-bison/2015-01/msg00059.html

* tests/actions.at (Qualified $$ in actions): Don't use "static",
prefer anonymous namespace.
2015-01-22 08:45:44 +01:00
Akim Demaille
eabb3df7aa Merge remote-tracking branch 'origin/maint' into origin/master
* origin/maint:
  doc: minor fixes
  gnulib: strtoul is considered obsolete and now useless
  c++: avoid warnings when destructors don't use $$
  maint: post-release administrivia
  version 3.0.3
  gnulib: update
2015-01-16 15:14:41 +01:00
Akim Demaille
3e82dfaa0d c++: avoid warnings when destructors don't use $$
* data/c++.m4: here.
2015-01-15 14:29:22 +01:00