Theophile Ranquet 1dbaf37f5c lalr1.cc: change symbols implementation
A "symbol" groups together the symbol type (INT, PLUS, etc.), its
possible semantic value, and its optional location.  The type is
needed to access the value, as it is stored as a variant/union.

There are two kinds of symbols. "symbol_type" are "external symbols":
they have type, value and location, and are returned by yylex.
"stack_symbol_type" are "internal symbols", they group state number,
value and location, and are stored in the parser stack.  The type of
the symbol is computed from the state number.

The class template symbol_base_type<Exact> factors the code common to
stack_symbol_type and symbol_type.  It uses the Curiously Recurring
Template pattern so that we can always (static_) downcast to the exact
type.  symbol_base_type features value and location, and delegates the
handling of the type to its parameter.

When trying to generalize the support for variant, a significant issue
was revealed: because stack_symbol_type and symbol_type _derive_ from
symbol_base_type, the type/state member is defined _after_ the value
and location.  In C++ the order of the definition of the members
defines the order in which they are initialized, things go backward:
the value is initialized _before_ the type.  This is wrong, since the
type is needed to access the value.

Therefore, we need another means to factor the common code, one that
ensures the order of the members.

The idea is simple: define two (base) classes that code the symbol
type ("by_type" codes it by its type, and "by_state" by the state
number).  Define basic_symbol<Base> as the class template that
provides value and location support.  Make it _derive_ from its
parameter, by_type or by_state.  Then define stack_symbol_type and
symbol_type as basic_symbol<by_state>, basic_symbol<by_type>.  The
name basic_symbol was chosen by similarity with basic_string and
basic_ostream.

* data/c++.m4 (symbol_base_type<Exact>): Remove, replace by...
(basic_symbol<Base>): which derives from its parameter, one of...
(by_state, by_type): which provide means to retrieve the actual type of
symbol.
(symbol_type): Is now basic_symbol<by_type>.
(stack_symbol_type): Is now basic_symbol<by_state>.
* data/lalr1.cc: Many adjustments.
2013-01-11 18:57:08 +01:00
2012-12-26 10:38:59 +01:00
2013-01-04 16:26:14 +01:00
2013-01-09 16:41:16 +01:00
2012-12-31 16:32:12 +01:00
2012-05-24 13:54:55 +02:00
2012-11-01 15:37:57 +01:00
2012-07-24 12:22:17 +02:00
2006-01-22 07:59:51 +00:00
2006-01-22 07:59:51 +00:00
2012-02-14 20:12:56 +01:00
2013-01-09 16:41:16 +01:00
2007-08-15 20:21:33 +00:00
2012-01-13 10:09:44 +01:00
2012-01-13 10:09:44 +01:00
2012-12-31 16:32:12 +01:00

This package contains the GNU Bison parser generator.

* Installation
** Build
See the file INSTALL for generic compilation and installation
instructions.

Bison requires GNU m4 1.4.6 or later.  See:

      ftp://ftp.gnu.org/gnu/m4/m4-1.4.6.tar.gz

** Internationalization
Bison supports two catalogues: one for Bison itself (i.e., for the
maintainer-side parser generation), and one for the generated parsers
(i.e., for the user-side parser execution).  The requirements between
both differ: bison needs ngettext, the generated parsers do not.  To
simplify the build system, neither are installed if ngettext is not
supported, even if generated parsers could have been localized.  See
http://lists.gnu.org/archive/html/bug-bison/2009-08/msg00006.html for
more details.

* Questions
See the section FAQ in the documentation (doc/bison.info) for
frequently asked questions.  The documentation is also available in
PDF and HTML, provided you have a recent version of Texinfo installed:
run "make pdf" or "make html".

If you have questions about using Bison and the documentation does
not answer them, please send mail to <help-bison@gnu.org>.

* Bug reports
Please send bug reports to <bug-bison@gnu.org>.  Please include the
version number from `bison --version', and a complete, self-contained
test case in each bug report.

* Copyright statements
For any copyright year range specified as YYYY-ZZZZ in this package,
note that the range specifies every single year in that closed interval.


Local Variables:
mode: outline
End:

-----

Copyright (C) 1992, 1998-1999, 2003-2005, 2008-2012 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/>.
Description
No description provided
Readme 18 MiB
Languages
C 61%
M4 11.7%
C++ 11.3%
Shell 4.1%
XSLT 3.1%
Other 8.8%