mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-20 17:53:02 +00:00
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.
This commit is contained in:
3
README
3
README
@@ -37,13 +37,12 @@ test case in each bug report.
|
|||||||
For any copyright year range specified as YYYY-ZZZZ in this package,
|
For any copyright year range specified as YYYY-ZZZZ in this package,
|
||||||
note that the range specifies every single year in that closed interval.
|
note that the range specifies every single year in that closed interval.
|
||||||
|
|
||||||
|
-----
|
||||||
|
|
||||||
Local Variables:
|
Local Variables:
|
||||||
mode: outline
|
mode: outline
|
||||||
End:
|
End:
|
||||||
|
|
||||||
-----
|
|
||||||
|
|
||||||
Copyright (C) 1992, 1998-1999, 2003-2005, 2008-2015, 2018 Free Software
|
Copyright (C) 1992, 1998-1999, 2003-2005, 2008-2015, 2018 Free Software
|
||||||
Foundation, Inc.
|
Foundation, Inc.
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
-*- outline -*-
|
|
||||||
|
|
||||||
This directory contains data needed by Bison.
|
This directory contains data needed by Bison.
|
||||||
|
|
||||||
* Skeletons
|
* Skeletons
|
||||||
@@ -52,6 +50,10 @@ into various formats.
|
|||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
|
Local Variables:
|
||||||
|
mode: outline
|
||||||
|
End:
|
||||||
|
|
||||||
Copyright (C) 2002, 2008-2015, 2018 Free Software Foundation, Inc.
|
Copyright (C) 2002, 2008-2015, 2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GNU Bison.
|
This file is part of GNU Bison.
|
||||||
|
|||||||
39
examples/README
Normal file
39
examples/README
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
This directory contains examples of Bison grammar files.
|
||||||
|
|
||||||
|
* mfcalc
|
||||||
|
A C example of a multi-function calculator. Extracted from the
|
||||||
|
documentation.
|
||||||
|
|
||||||
|
* calc++
|
||||||
|
A C++ version of the canonical example for parsers: a calculator.
|
||||||
|
Also uses Flex for the scanner.
|
||||||
|
|
||||||
|
* variant.yy
|
||||||
|
A C++ examples that uses variants (they allow to use any C++ type as
|
||||||
|
semantic value type) and symbol constructors (they ensure consistency
|
||||||
|
between declared token type and effective semantic value).
|
||||||
|
|
||||||
|
-----
|
||||||
|
|
||||||
|
Local Variables:
|
||||||
|
mode: outline
|
||||||
|
End:
|
||||||
|
|
||||||
|
Copyright (C) 2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
|
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/>.
|
||||||
|
|
||||||
|
# LocalWords: mfcalc calc parsers yy
|
||||||
@@ -41,6 +41,13 @@ $(extracted): %D%/extracted.stamp
|
|||||||
@test -f $@ || rm -f %D%/extracted.stamp
|
@test -f $@ || rm -f %D%/extracted.stamp
|
||||||
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) %D%/extracted.stamp
|
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) %D%/extracted.stamp
|
||||||
|
|
||||||
|
## ---------- ##
|
||||||
|
## Examples. ##
|
||||||
|
## ---------- ##
|
||||||
|
|
||||||
|
examplesdir = $(docdir)/examples
|
||||||
|
dist_examples_DATA = %D%/README %D%/variant.yy
|
||||||
|
|
||||||
include %D%/calc++/local.mk
|
include %D%/calc++/local.mk
|
||||||
include %D%/mfcalc/local.mk
|
include %D%/mfcalc/local.mk
|
||||||
include %D%/rpcalc/local.mk
|
include %D%/rpcalc/local.mk
|
||||||
|
|||||||
@@ -88,13 +88,13 @@ result:
|
|||||||
;
|
;
|
||||||
|
|
||||||
list:
|
list:
|
||||||
/* nothing */ { /* Generates an empty string list */ }
|
%empty { /* Generates an empty string list */ }
|
||||||
| list item { std::swap ($$, $1); $$.push_back ($2); }
|
| list item { std::swap ($$, $1); $$.push_back ($2); }
|
||||||
;
|
;
|
||||||
|
|
||||||
item:
|
item:
|
||||||
TEXT { std::swap ($$, $1); }
|
TEXT { std::swap ($$, $1); }
|
||||||
| NUMBER { $$ = string_cast ($1); }
|
| NUMBER { $$ = string_cast ($1); }
|
||||||
;
|
;
|
||||||
%%
|
%%
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user