Commit Graph

15 Commits

Author SHA1 Message Date
Akim Demaille
76366e8e5c make: regenerate the example parsers when bison changes
* Makefile.am (dependencies): Also depend on Bison's sources.
2019-02-02 17:31:58 +01:00
Akim Demaille
2471733f1a package: bump copyrights to 2019 2019-01-05 14:58:05 +01:00
Akim Demaille
50285ff066 examples: fix dependencies
Commit 112ccb5ed7 moved the skeletons
from dist_pkgdata_DATA to dist_skeletons_DATA, hence broke the dependencies.

* Makefile.am (dependencies): New.
Use it where appropriate.
2018-12-26 08:44:01 +01:00
Akim Demaille
d657da9fb4 examples: add a simple Flex+Bison example in C
Suggested by Askar Safin.
http://lists.gnu.org/archive/html/bug-bison/2018-12/msg00003.html

* examples/c/lexcalc/Makefile, examples/c/lexcalc/README.md,
* examples/c/lexcalc/lexcalc.test, examples/c/lexcalc/local.mk,
* examples/c/lexcalc/parse.y, examples/c/lexcalc/scan.l:
New.
2018-12-09 15:30:25 +01:00
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
8ff6ff3ab0 examples: remove useless includes
* examples/c++/variant-11.yy, examples/c++/variant.yy: here.
Fix warning when storing a long into an int.
2018-11-13 06:53:21 +01:00
Akim Demaille
868ea55b7c tests: compile the C++ examples with warnings
* examples/c++/local.mk: Pass $(WARN_CXXFLAGS_TEST).
2018-11-12 18:20:21 +01:00
Akim Demaille
cf1446dc9e tests: don't fail if the C++ compiler does not work
Also, make sure that `make dist` generates a correct tarball even if
the C++ compiler does not work.

Reported by Nelson H. F. Beebe.

* m4/cxx.m4 (BISON_CXX_WORKS): Define to true/false instead of
true/exit 77.  The latter is too dangerous to use (it directly quits).
(ENABLE_CXX): New name for the Automake conditional, for consistency
with ENABLE_CXX11 etc.
* tests/local.at (AT_COMPILE, AT_COMPILE_CXX): Adjust to the new
semantics of BISON_CXX_WORKS.
* examples/c++/local.mk: Skip the variant test if C++ does not work.
* examples/calc++/local.mk: Likewise.
2018-11-04 17:56:09 +01:00
Akim Demaille
eff6739124 c++: workaround portability issue
On some systems (x86_64-pc-solaris2.11), with Developer Studio 12.5's
CC, we get:

    ".../include/CC/Cstd/vector.cc", line 127: Error: Cannot assign const yy::parser::stack_symbol_type to yy::parser::stack_symbol_type without "yy::parser::stack_symbol_type::operator=(const yy::parser::stack_symbol_type&)";.
    ".../include/CC/Cstd/vector", line 475:     Where: While instantiating "std::vector<yy::parser::stack_symbol_type>::__insert_aux(yy::parser::stack_symbol_type*, const yy::parser::stack_symbol_type&)".
    ".../include/CC/Cstd/vector", line 475:     Where: Instantiated from non-template code.
    1 Error(s) detected.

Don't expect __cplusplus to be always defined.  If it's not, consider
this is C++98.

Reported by Nelson H. F. Beebe.

* data/c++.m4, data/lalr1.cc, examples/c++/variant.yy, tests/local.at,
* tests/testsuite.h:
An undefined __cplusplus means pre C++11.
2018-11-04 08:00:01 +01:00
Akim Demaille
3f5e6905da doc: spell check
* README, doc/bison.texi, examples/README, examples/c++/README: here.
2018-10-26 08:40:07 +02:00
Akim Demaille
719782e6ba examples: add a Makefile for C++ short examples
* examples/c++/Makefile: New.
* examples/c++/local.mk, examples/c++/README: Adjust.
2018-10-26 08:35:10 +02:00
Akim Demaille
849d91bc02 configure: quit on trying to get ICC and Flex be friends
The CI is using Flex 2.5.35.  And ICC is too picky for it.  Let's stop
making these warnings errors.  I wish I could disable them in the
source files using the ICC version and the Flex version, but ICC's
pragma support is unclear, and I'm tired of fighting it.

* configure.ac (FLEX_SCANNER_CXXFLAGS): Make warnings warnings.
* examples/c++/local.mk: Comment changes.
2018-10-24 21:53:21 +02:00
Akim Demaille
5b879c8980 c++: std::to_string is available in C++11
Reported by Victor Khomenko.
http://lists.gnu.org/archive/html/bug-bison/2018-10/msg00033.html

* doc/bison.texi, examples/c++/variant-11.yy: Use std::to_string
instead of ours.
2018-10-24 18:49:04 +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
a4dce889a4 doc: an introductory example for C++
Suggested by Victor Khomenko.
http://lists.gnu.org/archive/html/bug-bison/2018-08/msg00037.html

* doc/bison.texi (A Simple C++ Example): New.
* examples/c++/local.mk, examples/c++/simple.test: New.
Extract, check, and install this new example.
* examples/local.mk: Adjust.
* examples/test: Adjust to the case where the dirname differs
from the test name.
2018-10-24 06:18:57 +02:00