mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
%define lr.type: make values lowercase IDs.
That is, "LALR" => "lalr", "IELR" => "ielr", and
"canonical LR" => "canonical-lr".
* NEWS (2.5): Update documentation.
* doc/bison.texinfo (Decl Summary): Likewise.
* src/ielr.c (ielr): Use new values.
* src/ielr.h (ielr): Update documentation.
* src/reader.c (prepare_percent_define_front_end_variables): Use
and validate new values.
* tests/existing.at (AT_TEST_EXISTING_GRAMMAR): Update test
grammars.
* tests/reduce.at (AT_TEST_LR_TYPE): Likewise.
(cherry picked from commit 6ba9640406)
This commit is contained in:
15
ChangeLog
15
ChangeLog
@@ -1,3 +1,18 @@
|
|||||||
|
2009-08-28 Joel E. Denny <jdenny@clemson.edu>
|
||||||
|
|
||||||
|
%define lr.type: make values lowercase IDs.
|
||||||
|
That is, "LALR" => "lalr", "IELR" => "ielr", and
|
||||||
|
"canonical LR" => "canonical-lr".
|
||||||
|
* NEWS (2.5): Update documentation.
|
||||||
|
* doc/bison.texinfo (Decl Summary): Likewise.
|
||||||
|
* src/ielr.c (ielr): Use new values.
|
||||||
|
* src/ielr.h (ielr): Update documentation.
|
||||||
|
* src/reader.c (prepare_percent_define_front_end_variables): Use
|
||||||
|
and validate new values.
|
||||||
|
* tests/existing.at (AT_TEST_EXISTING_GRAMMAR): Update test
|
||||||
|
grammars.
|
||||||
|
* tests/reduce.at (AT_TEST_LR_TYPE): Likewise.
|
||||||
|
|
||||||
2009-08-27 Eric Blake <ebb9@byu.net>
|
2009-08-27 Eric Blake <ebb9@byu.net>
|
||||||
|
|
||||||
scan-gram: avoid portability trap with ctype usage.
|
scan-gram: avoid portability trap with ctype usage.
|
||||||
|
|||||||
6
NEWS
6
NEWS
@@ -20,9 +20,9 @@ Bison News
|
|||||||
default. You can specify the type of parser tables in the grammar
|
default. You can specify the type of parser tables in the grammar
|
||||||
file with these directives:
|
file with these directives:
|
||||||
|
|
||||||
%define lr.type "LALR"
|
%define lr.type "lalr"
|
||||||
%define lr.type "IELR"
|
%define lr.type "ielr"
|
||||||
%define lr.type "canonical LR"
|
%define lr.type "canonical-lr"
|
||||||
|
|
||||||
The default reduction optimization in the parser tables can also be
|
The default reduction optimization in the parser tables can also be
|
||||||
adjusted using `%define lr.default-reductions'. See the documentation
|
adjusted using `%define lr.default-reductions'. See the documentation
|
||||||
|
|||||||
@@ -4956,7 +4956,7 @@ without performing any extra reductions.
|
|||||||
|
|
||||||
@item Default Value:
|
@item Default Value:
|
||||||
@itemize
|
@itemize
|
||||||
@item @code{"accepting"} if @code{lr.type} is @code{"canonical LR"}.
|
@item @code{"accepting"} if @code{lr.type} is @code{"canonical-lr"}.
|
||||||
@item @code{"all"} otherwise.
|
@item @code{"all"} otherwise.
|
||||||
@end itemize
|
@end itemize
|
||||||
@end itemize
|
@end itemize
|
||||||
@@ -5020,7 +5020,7 @@ More user feedback will help to stabilize it.)
|
|||||||
|
|
||||||
@item Accepted Values:
|
@item Accepted Values:
|
||||||
@itemize
|
@itemize
|
||||||
@item @code{"LALR"}.
|
@item @code{"lalr"}.
|
||||||
While Bison generates @acronym{LALR} parser tables by default for
|
While Bison generates @acronym{LALR} parser tables by default for
|
||||||
historical reasons, @acronym{IELR} or canonical @acronym{LR} is almost
|
historical reasons, @acronym{IELR} or canonical @acronym{LR} is almost
|
||||||
always preferable for deterministic parsers.
|
always preferable for deterministic parsers.
|
||||||
@@ -5049,7 +5049,7 @@ investigate such problems while ignoring the more subtle differences
|
|||||||
from @acronym{IELR} and canonical @acronym{LR}.
|
from @acronym{IELR} and canonical @acronym{LR}.
|
||||||
@end itemize
|
@end itemize
|
||||||
|
|
||||||
@item @code{"IELR"}.
|
@item @code{"ielr"}.
|
||||||
@acronym{IELR} is a minimal @acronym{LR} algorithm.
|
@acronym{IELR} is a minimal @acronym{LR} algorithm.
|
||||||
That is, given any grammar (@acronym{LR} or non-@acronym{LR}),
|
That is, given any grammar (@acronym{LR} or non-@acronym{LR}),
|
||||||
@acronym{IELR} and canonical @acronym{LR} always accept exactly the same
|
@acronym{IELR} and canonical @acronym{LR} always accept exactly the same
|
||||||
@@ -5063,7 +5063,7 @@ grammars, the number of conflicts for @acronym{IELR} is often an order
|
|||||||
of magnitude less as well.
|
of magnitude less as well.
|
||||||
This can significantly reduce the complexity of developing of a grammar.
|
This can significantly reduce the complexity of developing of a grammar.
|
||||||
|
|
||||||
@item @code{"canonical LR"}.
|
@item @code{"canonical-lr"}.
|
||||||
@cindex delayed syntax errors
|
@cindex delayed syntax errors
|
||||||
@cindex syntax errors delayed
|
@cindex syntax errors delayed
|
||||||
The only advantage of canonical @acronym{LR} over @acronym{IELR} is
|
The only advantage of canonical @acronym{LR} over @acronym{IELR} is
|
||||||
@@ -5079,7 +5079,7 @@ Even when canonical @acronym{LR} behavior is ultimately desired,
|
|||||||
facilitate the development of a grammar.
|
facilitate the development of a grammar.
|
||||||
@end itemize
|
@end itemize
|
||||||
|
|
||||||
@item Default Value: @code{"LALR"}
|
@item Default Value: @code{"lalr"}
|
||||||
@end itemize
|
@end itemize
|
||||||
|
|
||||||
@item namespace
|
@item namespace
|
||||||
|
|||||||
@@ -1095,11 +1095,11 @@ ielr (void)
|
|||||||
/* Examine user options. */
|
/* Examine user options. */
|
||||||
{
|
{
|
||||||
char *type = muscle_percent_define_get ("lr.type");
|
char *type = muscle_percent_define_get ("lr.type");
|
||||||
if (0 == strcmp (type, "LALR"))
|
if (0 == strcmp (type, "lalr"))
|
||||||
lr_type = LR_TYPE__LALR;
|
lr_type = LR_TYPE__LALR;
|
||||||
else if (0 == strcmp (type, "IELR"))
|
else if (0 == strcmp (type, "ielr"))
|
||||||
lr_type = LR_TYPE__IELR;
|
lr_type = LR_TYPE__IELR;
|
||||||
else if (0 == strcmp (type, "canonical LR"))
|
else if (0 == strcmp (type, "canonical-lr"))
|
||||||
lr_type = LR_TYPE__CANONICAL_LR;
|
lr_type = LR_TYPE__CANONICAL_LR;
|
||||||
else
|
else
|
||||||
aver (false);
|
aver (false);
|
||||||
|
|||||||
@@ -33,9 +33,9 @@
|
|||||||
* - \c ::states is of size \c ::nstates (which might be greater than
|
* - \c ::states is of size \c ::nstates (which might be greater than
|
||||||
* <tt>::nstates \@pre</tt>) and defines the type of parser specified by
|
* <tt>::nstates \@pre</tt>) and defines the type of parser specified by
|
||||||
* the value of the \c \%define variable \c lr.type. Its value can be:
|
* the value of the \c \%define variable \c lr.type. Its value can be:
|
||||||
* - \c "LALR".
|
* - \c "lalr".
|
||||||
* - \c "IELR".
|
* - \c "ielr".
|
||||||
* - \c "canonical LR".
|
* - \c "canonical-lr".
|
||||||
*/
|
*/
|
||||||
void ielr (void);
|
void ielr (void);
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* A Bison parser, made by GNU Bison 2.4.1.124-faff. */
|
/* A Bison parser, made by GNU Bison 2.4.1.128-4bb9. */
|
||||||
|
|
||||||
/* Skeleton implementation for Bison's Yacc-like parsers in C
|
/* Skeleton implementation for Bison's Yacc-like parsers in C
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
#define YYBISON 1
|
#define YYBISON 1
|
||||||
|
|
||||||
/* Bison version. */
|
/* Bison version. */
|
||||||
#define YYBISON_VERSION "2.4.1.124-faff"
|
#define YYBISON_VERSION "2.4.1.128-4bb9"
|
||||||
|
|
||||||
/* Skeleton name. */
|
/* Skeleton name. */
|
||||||
#define YYSKELETON_NAME "yacc.c"
|
#define YYSKELETON_NAME "yacc.c"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* A Bison parser, made by GNU Bison 2.4.1.124-faff. */
|
/* A Bison parser, made by GNU Bison 2.4.1.128-4bb9. */
|
||||||
|
|
||||||
/* Skeleton interface for Bison's Yacc-like parsers in C
|
/* Skeleton interface for Bison's Yacc-like parsers in C
|
||||||
|
|
||||||
|
|||||||
@@ -608,9 +608,9 @@ prepare_percent_define_front_end_variables (void)
|
|||||||
char *lr_type;
|
char *lr_type;
|
||||||
/* IELR would be a better default, but LALR is historically the
|
/* IELR would be a better default, but LALR is historically the
|
||||||
default. */
|
default. */
|
||||||
muscle_percent_define_default ("lr.type", "LALR");
|
muscle_percent_define_default ("lr.type", "lalr");
|
||||||
lr_type = muscle_percent_define_get ("lr.type");
|
lr_type = muscle_percent_define_get ("lr.type");
|
||||||
if (0 != strcmp (lr_type, "canonical LR"))
|
if (0 != strcmp (lr_type, "canonical-lr"))
|
||||||
muscle_percent_define_default ("lr.default-reductions", "all");
|
muscle_percent_define_default ("lr.default-reductions", "all");
|
||||||
else
|
else
|
||||||
muscle_percent_define_default ("lr.default-reductions", "accepting");
|
muscle_percent_define_default ("lr.default-reductions", "accepting");
|
||||||
@@ -620,7 +620,7 @@ prepare_percent_define_front_end_variables (void)
|
|||||||
/* Check %define front-end variables. */
|
/* Check %define front-end variables. */
|
||||||
{
|
{
|
||||||
static char const * const values[] = {
|
static char const * const values[] = {
|
||||||
"lr.type", "LALR", "IELR", "canonical LR", NULL,
|
"lr.type", "lalr", "ielr", "canonical-lr", NULL,
|
||||||
"lr.default-reductions", "all", "consistent", "accepting", NULL,
|
"lr.default-reductions", "all", "consistent", "accepting", NULL,
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -42,18 +42,18 @@ AT_CHECK([[diff -u input-lalr.output input.output \
|
|||||||
[[0]], [$1])])
|
[[0]], [$1])])
|
||||||
|
|
||||||
AT_TEST_TABLES_AND_PARSE([$2[: LALR(1)]], [[LALR]], [[last-state]],
|
AT_TEST_TABLES_AND_PARSE([$2[: LALR(1)]], [[LALR]], [[last-state]],
|
||||||
[[%define lr.type "LALR"
|
[[%define lr.type "lalr"
|
||||||
]$3],
|
]$3],
|
||||||
[$4], [$5], [$6], [$7],
|
[$4], [$5], [$6], [$7],
|
||||||
[AT_LALR1_DIFF_CHECK([$8])$9], [$10], [$11], [$12])
|
[AT_LALR1_DIFF_CHECK([$8])$9], [$10], [$11], [$12])
|
||||||
AT_TEST_TABLES_AND_PARSE([$2[: IELR(1)]], [[IELR]], [[last-state]],
|
AT_TEST_TABLES_AND_PARSE([$2[: IELR(1)]], [[IELR]], [[last-state]],
|
||||||
[[%define lr.type "IELR"
|
[[%define lr.type "ielr"
|
||||||
]$3],
|
]$3],
|
||||||
[$4], [$5], [$6], [$7],
|
[$4], [$5], [$6], [$7],
|
||||||
[AT_LALR1_DIFF_CHECK([$8])$9], [$10], [$11], [$12])
|
[AT_LALR1_DIFF_CHECK([$8])$9], [$10], [$11], [$12])
|
||||||
AT_TEST_TABLES_AND_PARSE([$2[: Canonical LR(1)]], [[canonical LR]],
|
AT_TEST_TABLES_AND_PARSE([$2[: Canonical LR(1)]], [[canonical LR]],
|
||||||
[[last-state,no-xml]],
|
[[last-state,no-xml]],
|
||||||
[[%define lr.type "canonical LR"
|
[[%define lr.type "canonical-lr"
|
||||||
]$3],
|
]$3],
|
||||||
[$4], [$5], [$6], [$7],
|
[$4], [$5], [$6], [$7],
|
||||||
[$9], [$10], [$11], [$12])
|
[$9], [$10], [$11], [$12])
|
||||||
|
|||||||
@@ -375,19 +375,19 @@ m4_define([AT_TEST_LR_TYPE],
|
|||||||
AT_TEST_TABLES_AND_PARSE([[no %define lr.type: ]$1],
|
AT_TEST_TABLES_AND_PARSE([[no %define lr.type: ]$1],
|
||||||
[[LALR]], [[]],
|
[[LALR]], [[]],
|
||||||
[$2], m4_shiftn(2, $@))
|
[$2], m4_shiftn(2, $@))
|
||||||
AT_TEST_TABLES_AND_PARSE([[%define lr.type "LALR": ]$1],
|
AT_TEST_TABLES_AND_PARSE([[%define lr.type "lalr": ]$1],
|
||||||
[[LALR]], [[]],
|
[[LALR]], [[]],
|
||||||
[[%define lr.type "LALR"
|
[[%define lr.type "lalr"
|
||||||
]$2],
|
]$2],
|
||||||
m4_shiftn(2, $@))
|
m4_shiftn(2, $@))
|
||||||
AT_TEST_TABLES_AND_PARSE([[%define lr.type "IELR": ]$1],
|
AT_TEST_TABLES_AND_PARSE([[%define lr.type "ielr": ]$1],
|
||||||
[[IELR]], [[]],
|
[[IELR]], [[]],
|
||||||
[[%define lr.type "IELR"
|
[[%define lr.type "ielr"
|
||||||
]$2],
|
]$2],
|
||||||
m4_shiftn(2, $@))
|
m4_shiftn(2, $@))
|
||||||
AT_TEST_TABLES_AND_PARSE([[%define lr.type "canonical LR": ]$1],
|
AT_TEST_TABLES_AND_PARSE([[%define lr.type "canonical-lr": ]$1],
|
||||||
[[canonical LR]], [[]],
|
[[canonical LR]], [[]],
|
||||||
[[%define lr.type "canonical LR"
|
[[%define lr.type "canonical-lr"
|
||||||
]$2],
|
]$2],
|
||||||
m4_shiftn(2, $@))
|
m4_shiftn(2, $@))
|
||||||
])
|
])
|
||||||
|
|||||||
Reference in New Issue
Block a user