examples: add a demonstration of GLR parsers in C

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.
This commit is contained in:
Akim Demaille
2020-09-19 17:13:14 +02:00
parent d4ffb69424
commit 647453a614
6 changed files with 432 additions and 0 deletions

34
examples/c/glr/local.mk Normal file
View File

@@ -0,0 +1,34 @@
## Copyright (C) 2020 Free Software Foundation, Inc.
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
glrdir = $(docdir)/%D%
## ----------- ##
## c++-types. ##
## ----------- ##
check_PROGRAMS += %D%/c++-types
TESTS += %D%/c++-types.test
EXTRA_DIST += %D%/c++-types.test
nodist_%C%_c___types_SOURCES = %D%/c++-types.y
%D%/c++-types.c: $(dependencies)
# Don't use gnulib's system headers.
%C%_c___types_CPPFLAGS = -I$(top_srcdir)/%D% -I$(top_builddir)/%D%
%C%_c___types_CFLAGS = $(TEST_CFLAGS)
dist_glr_DATA = %D%/c++-types.y %D%/Makefile %D%/README.md
CLEANFILES += %D%/c++-types.c %D%/c++-types.output
CLEANDIRS += %D%/*.dSYM