Commit Graph

116 Commits

Author SHA1 Message Date
Akim Demaille
3fda8335bf examples: shorten the name of the calc++ files
* doc/bison.texi: Turn the calc++- prefix into calc++/.
* examples/extexi (%file_wanted): Replace with
(&file_wanted): this.
* examples/calc++/local.mk: Adjust.
2018-08-23 13:37:52 +02:00
Akim Demaille
32e0fd1a99 examples: add empty lines
Currently the examples are too dense, let's put empty lines where
'#line' would be issued.  And also remove some spurious empty
lines (remains from @group, @end group, etc.).

* examples/extexi: Do that.
* examples/local.mk (extexiFLAGS): Rename as...
(EXTEXIFLAGS): this.
2018-08-19 17:47:59 +02:00
Akim Demaille
b610f43f25 examples: check the variant example
* examples/mfcalc/local.mk, examples/rpcalc/local.mk: Define the
programs in a more natural order, source, preproc, then linker.

* examples/test: Be ready to work on programs that are not in
a subdir.
* examples/variant.test: New.
* examples/local.mk: Use it.
* examples/variant.yy: Don't use 0 for nullptr.
Use a more natural output for a list of string.
2018-08-19 17:47:59 +02:00
Akim Demaille
bbd17b68fb examples: fix Englishoes
* examples/README: Fix my mistakes.
2018-08-14 13:40:54 +02:00
Akim Demaille
30c179fee8 examples: ship and install variant.yy
This file was meant to be shown as an example.  Install it.

* README, data/README: Put Emacs metadata in the final section.
* examples/README: New.
* examples/variant.yy: Use %empty.
* examples/local.mk: Install both these files.
2018-08-14 13:36:47 +02:00
Akim Demaille
2e9e591889 Update copyright years
Run `make update-copyright`.
2018-05-12 18:18:41 +02:00
Akim Demaille
370a302f34 Examples: improve C++ style
* examples/variant.yy: Prefer vector to list.
Remove useless inline.
2018-05-12 14:04:04 +02:00
Akim Demaille
dbd1609311 style: don't use std::endl
* data/lalr1.cc, doc/bison.texi, etc/bench.pl.in, examples/variant.yy,
* tests/actions.at, tests/atlocal.in, tests/c++.at, tests/headers.at,
* tests/local.at, tests/types.at:
Don't use std::endl, it flushes uselessly, and is considered bad
style.
2018-05-08 12:35:06 +02:00
Akim Demaille
3209eb1c4c package: bump to 2015
Which also requires:

* gnulib: Update.
2015-01-04 17:49:13 +01:00
Akim Demaille
fc51acddb4 package: bump to 2014
* AUTHORS, ChangeLog-2012, Makefile.am, NEWS, PACKAGING, README,
* README-alpha, README-hacking, THANKS, TODO, bootstrap.conf,
* build-aux/darwin11.4.0.valgrind, build-aux/local.mk,
* build-aux/update-b4-copyright,
* build-aux/update-package-copyright-year, cfg.mk, configure.ac,
* data/README, data/bison.m4, data/c++-skel.m4, data/c++.m4,
* data/c-like.m4, data/c-skel.m4, data/c.m4, data/glr.c, data/glr.cc,
* data/java-skel.m4, data/java.m4, data/lalr1.cc, data/lalr1.java,
* data/local.mk, data/location.cc, data/stack.hh, data/variant.hh,
* data/xslt/bison.xsl, data/xslt/xml2dot.xsl, data/xslt/xml2text.xsl,
* data/xslt/xml2xhtml.xsl, data/yacc.c, djgpp/Makefile.maint,
* djgpp/README.in, djgpp/config.bat, djgpp/config.sed,
* djgpp/config.site, djgpp/config_h.sed, djgpp/djunpack.bat,
* djgpp/local.mk, djgpp/subpipe.c, djgpp/subpipe.h,
* djgpp/testsuite.sed, doc/bison.texi, doc/local.mk, doc/refcard.tex,
* etc/README, etc/bench.pl.in, etc/local.mk,
* examples/calc++/calc++.test, examples/calc++/local.mk,
* examples/extexi, examples/local.mk, examples/mfcalc/local.mk,
* examples/mfcalc/mfcalc.test, examples/rpcalc/local.mk,
* examples/rpcalc/rpcalc.test, examples/test, examples/variant.yy,
* lib/abitset.c, lib/abitset.h, lib/bbitset.h, lib/bitset.c,
* lib/bitset.h, lib/bitset_stats.c, lib/bitset_stats.h,
* lib/bitsetv-print.c, lib/bitsetv-print.h, lib/bitsetv.c,
* lib/bitsetv.h, lib/ebitset.c, lib/ebitset.h, lib/get-errno.c,
* lib/get-errno.h, lib/lbitset.c, lib/lbitset.h, lib/libiberty.h,
* lib/local.mk, lib/main.c, lib/timevar.c, lib/timevar.def,
* lib/timevar.h, lib/vbitset.c, lib/vbitset.h, lib/yyerror.c,
* m4/bison-i18n.m4, m4/c-working.m4, m4/cxx.m4, m4/flex.m4,
* m4/timevar.m4, src/AnnotationList.c, src/AnnotationList.h,
* src/InadequacyList.c, src/InadequacyList.h, src/LR0.c, src/LR0.h,
* src/Sbitset.c, src/Sbitset.h, src/assoc.c, src/assoc.h,
* src/closure.c, src/closure.h, src/complain.c, src/complain.h,
* src/conflicts.c, src/conflicts.h, src/derives.c, src/derives.h,
* src/files.c, src/files.h, src/flex-scanner.h, src/getargs.c,
* src/getargs.h, src/gram.c, src/gram.h, src/graphviz.c,
* src/graphviz.h, src/ielr.c, src/ielr.h, src/lalr.c, src/lalr.h,
* src/local.mk, src/location.c, src/location.h, src/main.c,
* src/muscle-tab.c, src/muscle-tab.h, src/named-ref.c,
* src/named-ref.h, src/nullable.c, src/nullable.h, src/output.c,
* src/output.h, src/parse-gram.c, src/parse-gram.y, src/print-xml.c,
* src/print-xml.h, src/print.c, src/print.h, src/print_graph.c,
* src/print_graph.h, src/reader.c, src/reader.h, src/reduce.c,
* src/reduce.h, src/relation.c, src/relation.h, src/scan-code.h,
* src/scan-code.l, src/scan-gram.h, src/scan-gram.l, src/scan-skel.h,
* src/scan-skel.l, src/state.c, src/state.h, src/symlist.c,
* src/symlist.h, src/symtab.c, src/symtab.h, src/system.h,
* src/tables.c, src/tables.h, src/uniqstr.c, src/uniqstr.h,
* tests/actions.at, tests/atlocal.in, tests/bison.in, tests/c++.at,
* tests/calc.at, tests/conflicts.at, tests/cxx-type.at,
* tests/existing.at, tests/glr-regression.at, tests/headers.at,
* tests/input.at, tests/java.at, tests/javapush.at, tests/local.at,
* tests/local.mk, tests/named-refs.at, tests/output.at, tests/push.at,
* tests/reduce.at, tests/regression.at, tests/sets.at,
* tests/skeletons.at, tests/synclines.at, tests/testsuite.at,
* tests/torture.at, tests/types.at:
here.
2014-02-03 15:27:02 +01:00
Akim Demaille
b167e7ba0d package: install the examples
Currently, we do not install the various examples extracted from the
documentation.  Let's do it, as they are useful starting points.

* configure.ac: When --enable-gcc-warnings is set, enable ENABLE_GCC_WARNINGS.
* examples/extexi: No longer issue synclines by default.
* examples/local.mk: Except if ENABLE_GCC_WARNINGS.
* examples/calc++/local.mk, examples/mfcalc/local.mk,
* examples/rpcalc/local.mk: Install the example files.
2013-12-09 16:53:14 +01:00
Akim Demaille
afc4457605 build: use Automake 1.14's non-recursive Makefile features
* configure.ac: Require Automake 1.14.
* examples/calc++/local.mk, examples/local.mk, examples/mfcalc/local.mk,
* examples/rpcalc/local.mk, tests/local.mk: Use %D% and %C%.
2013-11-05 14:32:20 +01:00
Paul Eggert
0bfe22b6d5 maint: git now ignores rpcalc
* examples/rpcalc/.gitignore: Ignore rpcalc.
2013-10-21 15:23:43 -07:00
Paul Eggert
3a684d611e build: examples/calc++/calc++ requires flex
* configure.ac (FLEX_CXX_WORKS): New AM_CONDITIONAL.
* examples/calc++/local.mk (examples/calc++/calc++):
Build if FLEX_CXX_WORKS, not BISON_CXX_WORKS.
2013-10-21 15:23:42 -07:00
Akim Demaille
b51cf830a6 examples: improve the output of the "variant" example
* examples/variant.yy: Improve the printing of lists.
2013-09-19 15:57:59 +02:00
Paul Eggert
1d91bfdf1c build: port to pre-5.8.7 perl
* examples/local.mk (extract): Omit -f from perl options.
This doesn't work with perl versions before 5.8.7
that are configured without USE_SITECUSTOMIZE.
Reported by Michael Felt in
<http://lists.gnu.org/archive/html/bug-bison/2013-08/msg00006.html>.
2013-08-24 07:55:47 -07:00
Akim Demaille
0fcc2e9a74 build: ship all the files, even if the C++ compiler is broken
* examples/calc++/local.mk: Be sure to ship calc++.test even if
the current C++ compiler is not sufficient to run the tests.
2013-06-11 16:36:38 +02:00
Akim Demaille
5ae8eb3202 tests: fix failures with G++ 4.8 in Flex scanner
* configure.ac (WARN_NO_NULL_CONVERSION_CXXFLAGS): Rename as...
(FLEX_SCANNER_CXXFLAGS): this.
Pass -Wno-zero-as-null-pointer-constant to G++ if it supports it.
* examples/calc++/local.mk: Adjust.
2013-02-19 17:42:33 +01:00
Theophile Ranquet
be6fa942ac variants: avoid type punning issue
This is based on what is recommended by both Scott Meyers, in 'Effective
C++', and Andrei Alexandrescu and Herb Sutter in 'C++ Coding Standards'.

Use a static_cast on void* rather than directly use a reinterpret_cast,
which can have nefarious effects on objects.  However, even though following
this guideline is good practice in general, I am not quite sure how relevant
it is when applied to conversions from POD to objects.  Actually, it might
very well be the opposite: isn't this exactly what reinterpret_cast is for?
What we really want *is* to transmit the memory map as a series of bytes,
which, if I am correct, falls into the kind of "low level" hack for which
this cast is meant.

In any case, this silences the warning, which will be greatly appreciated by
anyone using variants with a compiler supporting -fstrict-aliasing.

* data/variant.hh (as): Here.
* tests/c++.at (Exception safety, C++ Variant-based Symbols, Variants):
Don't use NO_STRICT_ALIAS_CXXFLAGS (revert commit ddb9db15), as type punning
is no longer an issue.
* tests/atlocal.in, configure.ac (NO_STRICT_ALIAS_CXXFLAGS): Remove
definition.
* examples/local.mk (NO_STRICT_ALIAS_CXXFLAGS): Remove from AM_CXXFLAGS.
* doc/bison.texi: Don't mention type punning issues.
2013-02-01 15:06:20 +01:00
Akim Demaille
1217688141 build: please Clang++ 3.2+ on Flex scanners
Clang++, with -Wall, rejects code generated by Flex (for C scanners):

  CXX      examples/calc++/examples_calc___calc__-calc++-scanner.o
  In file included from examples/calc++/calc++-scanner.cc:1:
  error: implicit conversion of NULL constant to 'bool' [-Werror,-Wnull-conversion]
  if ( ! ( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top)] : __null) ) {
       ~                                                                  ^~~~~~
                                                                          false
* configure.ac (WARN_NO_NULL_CONVERSION_CXXFLAGS): Compute it.
* examples/calc++/local.mk (examples_calc___calc___CXXFLAGS): Use it.
2013-01-30 16:10:00 +01:00
Akim Demaille
7d6bad1959 maint: update copyright years
Suggested by Stefano Lattarini.
Run "make update-copyright".
2013-01-12 16:14:16 +01:00
Akim Demaille
304b384ea3 examples: minor improvements
* examples/variant.yy: Don't use debug_stream(), obsoleted.
Use <*>.
2012-12-26 10:38:59 +01:00
Akim Demaille
ae8880deec doc: update variant usage
* doc/bison.texi, examples/variant.yy: Use "%define api.value.type variant",
instead of "%define variant".
2012-12-26 10:31:42 +01:00
Akim Demaille
a89a5b1442 tests: be robust to set -e.
* examples/test (run): here.
2012-12-21 13:24:51 +01:00
Akim Demaille
2f130f199a tests: use -fno-strict-aliasing with variants
Reported by Théophile Ranquet.

* configure.ac (NO_STRICT_ALIAS_CXXFLAGS): New.
* tests/c++.at, tests/atlocal.in, examples/local.mk: Use it.
2012-11-26 11:00:05 +01:00
Akim Demaille
e36ec1f41f lalr1.cc: rename lex_symbol as api.token.constructor
* data/bison.m4 (b4_lex_symbol_if): Rename as...
(b4_token_ctor_if): this.
Depend upon api.token.constructor.
* data/c++.m4, data/lalr1.cc: Adjust.
* doc/bison.texi: Fix all the occurrences of lex_symbol.
* etc/bench.pl.in: Adjust.
* examples/variant.yy: Likewise.

* tests/local.at (AT_BISON_OPTION_PUSHDEFS, AT_BISON_OPTION_POPDEFS):
Handle AT_TOKEN_CTOR_IF.
* tests/c++.at: Adjust to using api.token.constructor and AT_TOKEN_CTOR_IF.
Simplify the test of both build call styles.
(AT_CHECK_VARIANTS): Rename as...
(AT_TEST): this.
And undef when done.
2012-11-01 18:26:04 +01:00
Akim Demaille
0b3287025d examples: simplify/improve
* examples/variant.yy: Put yylex in yy::, and simplify accordingly.
Minor formatting changes.
2012-11-01 18:26:04 +01:00
Akim Demaille
b611359d90 tests: fix VPATH issue
* examples/test: With an absolute VPATH build, "../" is incorrect.
2012-07-20 18:23:44 +02:00
Akim Demaille
22b081deb7 Merge remote-tracking branch 'origin/maint'
* origin/maint:
  maint: use *.texi.

Conflicts:
	doc/Makefile.am
	examples/calc++/Makefile.am
2012-06-26 17:14:36 +02:00
Akim Demaille
9bcffa0c13 maint: use *.texi.
This is more consistent with the other packages, and Automake-NG
supports only *.texi.

* doc/bison.texinfo: Rename as...
* doc/bison.texi: this.
* doc/Makefile.am, examples/calc++/Makefile.am: Adjust.
2012-06-26 16:55:23 +02:00
Akim Demaille
9fd33c2b6e maint: address syntax-check issues.
* examples/calc++/local.mk: Space changes.
* src/files.c: Avoid unmarked_diagnostics.
* src/output.c: Remove useless include.
2012-06-21 16:02:10 +02:00
Akim Demaille
c50263271d %printer: support both yyo and yyoutput.
lalr1.cc used to support yyo, but not yyoutput.  Support both,
but document only yyoutput (at least until there is some consensus
on this).

* data/c.m4 (yy_symbol_value_print): Also support yyo.
* data/glr.cc  (yy_symbol_value_print_): Support both yyo and yyoutput.
* data/lalr1.cc: Also support yyoutput.
* doc/bison.texinfo: Explicitly use yyoutput in the examples.
* examples/mfcalc/mfcalc.test: Test the -p option.
2012-04-16 17:04:14 +02:00
Akim Demaille
830e733076 build: extexi: support out-of-order blocks.
* examples/extexi (%file_output): Remove.
(&process): Accept "FILE: BLOCK-NUM" requests.
2012-04-08 09:49:06 +02:00
Akim Demaille
5aaad6c431 build: look for Perl in configure.
Bison uses "/usr/bin/perl" or "perl" in several places, and it does
not appear to be a problem.  But, at least to make it simpler to
change PERL on the make command line, check for perl in configure.

* configure.ac (PERL): New.
* doc/Doxyfile.in, doc/local.mk, examples/local.mk,
* tests/bison.in: Use it.
2012-04-08 09:49:06 +02:00
Akim Demaille
8e15fef554 maint: rewrite extexi in Perl.
* examples/extexi: Rewrite in Perl.
* examples/local.mk (extract): Adjust.
2012-04-08 09:49:06 +02:00
Akim Demaille
fca5693b76 maint: fix distcheck.
* examples/local.mk (MAINTAINERCLEANFILES): Complete, and rename as...
(CLEANFILES): this,
* examples/calc++/local.mk, examples/mfcalc/local.mk,
* examples/rpcalc/local.mk (CLEANFILES): Add the generated files.
2012-03-13 11:58:46 +01:00
Akim Demaille
2a55930762 build: comment changes.
* Makefile.am, examples/calc++/local.mk, examples/local.mk,
	* examples/mfcalc/local.mk, examples/rpcalc/local.mk,
	* lib/local.mk, src/local.mk, tests/local.mk:
	Make the copyright licenses more uniform.
2012-02-24 14:01:13 +01:00
Akim Demaille
59fba180a5 build: fix more example extraction issues.
* Makefile.am (dist_TESTS): New.
	(TESTS, EXTRA_DIST): Run and ship them.
	* examples/calc++/local.mk: examples/calc++/calc++.stamp no longer
        exists, don't try to ship it.
	(.yy.stamp): New recipe.
	Use it.
	* examples/calc++/local.mk, examples/mfcalc/local.mk,
	* examples/rpcalc/local.mk:
	Don't ship the sources.
	Adjust the CPPFLAGS: there is nothing left in srcdir.
	(MAINTAINERCLEANFILES): Remove, now we are in builddir.
	(TESTS): Rename as...
	(dist_TESTS): this.
2012-02-24 13:32:17 +01:00
Akim Demaille
2191bb749b maint: fix example extraction issues.
calc++: don't rely on Automake to compile a C++ parser.

Basically, revert commit 609b3d8096,
Automake 1.11.3 is not safe enough for C++ parser.

	* examples/calc++/calc++-parser.hh: Remove.
	* examples/calc++/local.mk (examples/calc++/calc++-parser.stamp):
	New.

examples: factor the extractions into a single step

extexi had to be run in the extraction directory.  Now, it can be
given the files with expected output directory.  This allows to
use $(*_extracted) variables (before we had to list again their
members, but limited to their base names).  In turn, this also
allows fusing the extraction recipes into a single one.

Also, it is currently too hard (or requires too much duplication,
since Make wants all the occurrences of the files to be prefixed with
$(srcdir)/, which is something Automake cannot support for *_SOURCES)
to work in the source tree.  So extract, and compile scanners and parsers
in the build tree.

	* examples/extexi (basename): New.
	(BEGIN): Now "file_wanted" maps base name to extracted file name.
	* examples/calc++/local.mk, examples/mfcalc/local.mk,
	* examples/rpcalc/local.mk: Fuse extraction rules into...
	* examples/local.mk: Here.
	(extract, extracted): New.
2012-02-24 11:04:45 +01:00
Akim Demaille
baf22389ef maint: gitignore.
* examples/mfcalc/.gitignore, examples/rpcalc/.gitignore: Fix.
2012-02-22 14:55:32 +01:00
Akim Demaille
24ec083743 doc: check the rpcalc.
* doc/bison.texinfo: Tag rpcalc.y snippets.
	Add missing includes.
	(Rpcalc Rules): Don't issue leading tabs.
	Complete an Info menu.
	Use @result.
	* examples/rpcalc/local.mk: New.
	* examples/rpcalc/rpcalc.test: New.
	* examples/local.mk: Use them.
	* examples/mfcalc/mfcalc.test: Remove dup test.
	* examples/test: Disable debug traces.
2012-02-19 13:16:15 +01:00
Akim Demaille
f483f4f8ec maint: remove trailing empty lines.
* cfg.mk: No longer skip sc_prohibit_empty_lines_at_EOF, except
	for parse-gram.h (generated).
	* examples/mfcalc/.gitignore, lib/.gitignore, m4/.gitignore,
	* po/.gitignore, runtime-po/.gitignore: Remove trailing/leading
	empty lines.
2012-02-18 19:32:19 +01:00
Akim Demaille
5a9c6b89d0 examples: factor the test suite.
* examples/mfcalc/test, examples/calc++/test: Extract the
	common bits into...
	* examples/test: here.
	(cwd): New.
	Use it to avoid a race on the temporary directory.
	Reported by Jim Meyering.
	* examples/mfcalc/test, examples/calc++/test: Rename into...
	* examples/mfcalc/mfcalc.test, examples/calc++/calc++.test: these.
	* examples/calc++/local.mk, examples/mfcalc/local.mk,
	* examples/local.mk: Adjust.
2012-02-17 15:49:00 +01:00
Akim Demaille
c3a2e0e6dd examples: fix the test suites.
* examples/calc++/test, examples/mfcalc/test (me): Be more
	meaningfull: include the example name.
	(prog): Factor.
	(run): Avoid printf, use echo.
	Add missing parens.
	(cleanup): New.
	Call it on trap.
	Remove the previous "rm" that did the cleanup.
	Move into a private directory to avoid concurrency issues.
	Reported by Jim Meyering.
2012-02-17 10:20:03 +01:00
Jim Meyering
dfd31acea7 examples: link mfcalc with -lm for uses of pow, cos, atan, etc.
* examples/mfcalc/local.mk (examples_mfcalc_mfcalc_LDADD): Define.
2012-02-17 09:41:05 +01:00
Akim Demaille
c1192f8af3 mfcalc: extract and exercise.
* examples/mfcalc/local.mk, examples/mfcalc/test: New,
	based on calc++'s ones.
	* examples/local.mk: Include mfcalc/local.mk.
2012-02-16 15:52:14 +01:00
Akim Demaille
2e4986a88d calc++: factor for other extracted tests.
* Makefile.am (TESTS, check_PROGRAMS): Initialize here.
	* examples/local.mk (doc, extexi): Define here.
	* examples/calc++/local.mk: Adjust accordingly.
	* configure.ac: Ask for parallel-tests (for the way the logs
	are handled).
	* examples/calc++/test: As a consequence, always be verbose.
	($prog): New.
	(run): Use it.
	Sort the tests in a more natural order (simplest first).
2012-02-16 15:52:14 +01:00
Akim Demaille
f9c75dd016 doc: fix mfcalc code.
* doc/bison.texinfo (Multi-function Calc): Add missing includes.
	Fix the rendering of the result: use @result and remove the
	initial tabulation in the actual code.
	Fix stylistic issues: avoid the , operator.
	Add extexi mark-up.
	* examples/extexi: Also support @smallexample.
2012-02-16 15:52:13 +01:00
Akim Demaille
3d6ca33908 maint: trust Automake for parser headers.
* examples/calc++/local.mk, src/local.mk: Now that automake
	can see `-d' in AM_YFLAGS, we can rely on it to compile
	and ship the parser header files.
2012-02-15 13:33:42 +01:00
Akim Demaille
609b3d8096 calc++: rely on Automake.
Rely on $(YACC) being the bison being built, and let Automake do the
rest.  It turned out to be much more difficult than anticipated, for
various reasons, including some bad behavior from Automake 1.11.2
which (i) generates calc++-parser.h instead of calc++-parser.hh, and
(ii) leaves an #include "y.tab.h" in the generated parser instead
of #include "calc++-parser.h".

The authors of Automake appear to be aware of the problem,
http://lists.gnu.org/archive/html/automake/2011-05/msg00008.html
so a simple work around will suffice for the time being.

	* examples/calc++/y.tab.h, examples/calc++/calc++-parser.hh: New.
	To work around Automake 1.11.2 issues.
	* examples/calc++/local.mk: Remove all the rules for compilation
	with bison, leave them to Automake.
	So provide it with "calc++-parse.yy" as a source file.
	(calc_sources_generated, calc_sources_extracted): Rename as.
	(calc_generated, calc_extracted): these.
	(calc_sources): New.
	Fix them.
2012-02-15 11:31:49 +01:00