bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

examples: move the variant examples into the C++ directory


From: Akim Demaille
Subject: examples: move the variant examples into the C++ directory
Date: Wed, 24 Oct 2018 06:23:01 +0200

commit d4bee0211d6e701083cdf3066dec4c89ec0e97a6
Author: Akim Demaille <address@hidden>
Date:   Tue Oct 23 21:04:06 2018 +0200

    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.

diff --git a/NEWS b/NEWS
index 6aa017cd..d6420364 100644
--- a/NEWS
+++ b/NEWS
@@ -16,6 +16,10 @@ GNU Bison NEWS
 
   In C++ parsers, parser::operator() is now a synonym for the parser::parse.
 
+** Documentation
+
+  A new section, "A Simple C++ Example", is a tutorial for parsers in C++.
+
 * Noteworthy changes in release 3.1.91 (2018-10-18) [beta]
 
 ** Bug fixes
@@ -88,7 +92,7 @@ GNU Bison NEWS
   Enabling api.value.automove does not require support for modern C++.  The
   generated code is valid C++98/03, but will use copies instead of moves.
 
-  The new examples/variant-11.yy shows these features in action.
+  The new examples/c++/variant-11.yy shows these features in action.
 
 *** C++: The implicit default semantic action is always run
 
diff --git a/examples/README b/examples/README
index dc51bb56..e309e083 100644
--- a/examples/README
+++ b/examples/README
@@ -24,15 +24,7 @@ 
https://www.gnu.org/software/bison/manual/html_node/Multi_002dfunction-Calc.html
 
 * Examples in C++
 
-** variant.yy - Self-contained example in C++
-A simple C++ example in a single file, based on variants and symbol
-constructors.  Variants allow to use any C++ type as semantic value type,
-and symbol constructors ensure consistency between declared token type and
-effective semantic value.
-
-** variant-11.yy - Self-contained example in modern C++
-Another simple C++ example, closely related to the previous one, but
-exhibiting support for C++11's move semantics.
+** c++ - A directory of simple C++ examples
 
 ** calc++ - A Complete C++ Example
 A fully featured C++ version of the canonical example for parsers: a
diff --git a/examples/c++/README b/examples/c++/README
new file mode 100644
index 00000000..e4154961
--- /dev/null
+++ b/examples/c++/README
@@ -0,0 +1,38 @@
+This directory contains examples of Bison grammar files in C++.
+
+* Examples in C++
+
+** simple.yy - Simple example in C++14
+A very simple example in C++, based on variants and symbol constructors.
+Variants allow to use any C++ type as semantic value type, and symbol
+constructors ensure consistency between declared token type and effective
+semantic value.
+
+Extracted from the documentation: "A Simple C++ Example".
+https://www.gnu.org/software/bison/manual/html_node/A-Simple-C_002b_002b-Example.html
+
+** variant.yy - Self-contained example in C++98
+A varition of simple.yy, in C++98.
+
+** variant-11.yy - Self-contained example in modern C++
+Another variation of simple.yy, closely related to the previous one, but
+exhibiting support for C++11's move semantics.
+
+
+-----
+
+Local Variables:
+mode: outline
+fill-column: 76
+End:
+
+Copyright (C) 2018 Free Software Foundation, Inc.
+
+Permission is granted to copy, distribute and/or modify this document
+under the terms of the GNU Free Documentation License, Version 1.3 or
+any later version published by the Free Software Foundation; with no
+Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
+Texts.  A copy of the license is included in the "GNU Free
+Documentation License" file as part of this distribution.
+
+# LocalWords:  mfcalc calc parsers yy
diff --git a/examples/c++/local.mk b/examples/c++/local.mk
index 438decba..50ca05e8 100644
--- a/examples/c++/local.mk
+++ b/examples/c++/local.mk
@@ -13,13 +13,16 @@
 ## You should have received a copy of the GNU General Public License
 ## along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-## -------------------- ##
-## Building & testing.  ##
-## -------------------- ##
+cxxdir = $(exampledir)/c++
+
+## -------- ##
+## Simple.  ##
+## -------- ##
 
 BUILT_SOURCES += $(simple_sources)
 CLEANFILES +=  %D%/simple.[ch] %D%/simple.output
 CLEANDIRS += %D%/*.dSYM
+cxx_DATA = $(simple_extracted)
 
 simple_extracted = %D%/simple.yy
 simple_sources = $(simple_extracted)
@@ -37,9 +40,24 @@ if ENABLE_CXX14
 endif
 
 
-## ------------ ##
-## Installing.  ##
-## ------------ ##
+## ---------- ##
+## Variants.  ##
+## ---------- ##
 
-cxxdir = $(docdir)/examples/c++
-cxx_DATA = $(simple_extracted)
+check_PROGRAMS += %D%/variant
+nodist_%C%_variant_SOURCES = %D%/variant.yy
+%C%_variant_CPPFLAGS = -I$(top_builddir)
+dist_TESTS += %D%/variant.test
+%D%/variant.cc: $(BISON_IN) $(dist_pkgdata_DATA)
+
+if ENABLE_CXX11
+  check_PROGRAMS += %D%/variant-11
+  nodist_%C%_variant_11_SOURCES = %D%/variant-11.yy
+  %C%_variant_11_CXXFLAGS = $(CXX11_CXXFLAGS)
+  %C%_variant_11_CPPFLAGS = -I$(top_builddir)
+  dist_TESTS += %D%/variant-11.test
+  %D%/variant-11.cc: $(BISON_IN) $(dist_pkgdata_DATA)
+endif
+
+dist_cxx_DATA = %D%/README %D%/variant.yy %D%/variant-11.yy
+CLEANFILES += %D%/variant.output %D%/variant-11.output
diff --git a/examples/variant-11.test b/examples/c++/variant-11.test
similarity index 100%
rename from examples/variant-11.test
rename to examples/c++/variant-11.test
diff --git a/examples/variant-11.yy b/examples/c++/variant-11.yy
similarity index 100%
rename from examples/variant-11.yy
rename to examples/c++/variant-11.yy
diff --git a/examples/variant.test b/examples/c++/variant.test
similarity index 100%
rename from examples/variant.test
rename to examples/c++/variant.test
diff --git a/examples/variant.yy b/examples/c++/variant.yy
similarity index 100%
rename from examples/variant.yy
rename to examples/c++/variant.yy
diff --git a/examples/local.mk b/examples/local.mk
index 81ecbfab..28f6edd5 100644
--- a/examples/local.mk
+++ b/examples/local.mk
@@ -48,24 +48,7 @@ $(extracted): %D%/extracted.stamp
 
 
 examplesdir = $(docdir)/examples
-dist_examples_DATA = %D%/README %D%/variant.yy %D%/variant-11.yy
 
-check_PROGRAMS += %D%/variant
-nodist_%C%_variant_SOURCES = %D%/variant.yy
-%C%_variant_CPPFLAGS = -I$(top_builddir)
-dist_TESTS += %D%/variant.test
-%D%/variant.cc: $(BISON_IN) $(dist_pkgdata_DATA)
-
-if ENABLE_CXX11
-  check_PROGRAMS += %D%/variant-11
-  nodist_%C%_variant_11_SOURCES = %D%/variant-11.yy
-  %C%_variant_11_CXXFLAGS = $(CXX11_CXXFLAGS)
-  %C%_variant_11_CPPFLAGS = -I$(top_builddir)
-  dist_TESTS += %D%/variant-11.test
-  %D%/variant-11.cc: $(BISON_IN) $(dist_pkgdata_DATA)
-endif
-
-CLEANFILES += %D%/variant.output %D%/variant-11.output
 CLEANDIRS += %D%/*.dSYM
 
 include %D%/calc++/local.mk




reply via email to

[Prev in Thread] Current Thread [Next in Thread]