mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-18 16:53:02 +00:00
Fix some comments concerning LR(0) versus LALR(1).
Stop equating LR(0) with nondeterminism and LALR(1) with
determinism. That is, if all states are consistent, then LR(0)
tables are deterministic. On the other hand, LALR(1) tables
might be nondeterministic before conflict resolution, and GLR
permits LALR(1) tables to remain nondeterministic.
* src/LR0.c, src/LR0.h: Here.
* src/lalr.c, src/lalr.h: Here.
* src/main.c (main): Here.
* src/state.c, src/state.h: Here.
* src/ielr.h (ielr): In preconditions, expect LR(0) not LALR(1)
parser tables.
(cherry picked from commit 1c4ad777cb)
This commit is contained in:
17
ChangeLog
17
ChangeLog
@@ -1,3 +1,20 @@
|
|||||||
|
2010-01-04 Joel E. Denny <jdenny@clemson.edu>
|
||||||
|
|
||||||
|
Fix some comments concerning LR(0) versus LALR(1).
|
||||||
|
|
||||||
|
Stop equating LR(0) with nondeterminism and LALR(1) with
|
||||||
|
determinism. That is, if all states are consistent, then LR(0)
|
||||||
|
tables are deterministic. On the other hand, LALR(1) tables
|
||||||
|
might be nondeterministic before conflict resolution, and GLR
|
||||||
|
permits LALR(1) tables to remain nondeterministic.
|
||||||
|
* src/LR0.c, src/LR0.h: Here.
|
||||||
|
* src/lalr.c, src/lalr.h: Here.
|
||||||
|
* src/main.c (main): Here.
|
||||||
|
* src/state.c, src/state.h: Here.
|
||||||
|
|
||||||
|
* src/ielr.h (ielr): In preconditions, expect LR(0) not LALR(1)
|
||||||
|
parser tables.
|
||||||
|
|
||||||
2010-01-04 Joel E. Denny <jdenny@clemson.edu>
|
2010-01-04 Joel E. Denny <jdenny@clemson.edu>
|
||||||
|
|
||||||
maint: run "make update-copyright"
|
maint: run "make update-copyright"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* Generate the nondeterministic finite state machine for Bison.
|
/* Generate the LR(0) parser states for Bison.
|
||||||
|
|
||||||
Copyright (C) 1984, 1986, 1989, 2000-2002, 2004-2010 Free Software
|
Copyright (C) 1984, 1986, 1989, 2000-2002, 2004-2010 Free Software
|
||||||
Foundation, Inc.
|
Foundation, Inc.
|
||||||
@@ -328,8 +328,8 @@ set_states (void)
|
|||||||
|
|
||||||
|
|
||||||
/*-------------------------------------------------------------------.
|
/*-------------------------------------------------------------------.
|
||||||
| Compute the nondeterministic finite state machine (see state.h for |
|
| Compute the LR(0) parser states (see state.h for details) from the |
|
||||||
| details) from the grammar. |
|
| grammar. |
|
||||||
`-------------------------------------------------------------------*/
|
`-------------------------------------------------------------------*/
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
/* Generate the nondeterministic finite state machine for bison,
|
/* Generate the LR(0) parser states for Bison.
|
||||||
|
|
||||||
Copyright (C) 1984, 1986, 1989, 2000-2002, 2009-2010 Free Software
|
Copyright (C) 1984, 1986, 1989, 2000-2002, 2009-2010 Free Software
|
||||||
Foundation, Inc.
|
Foundation, Inc.
|
||||||
|
|
||||||
|
|||||||
@@ -26,8 +26,8 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \pre
|
* \pre
|
||||||
* - \c ::states is of size \c ::nstates and defines an LALR(1) parser for
|
* - \c ::states is of size \c ::nstates and defines an LR(0) parser
|
||||||
* the users's grammar.
|
* for the users's grammar.
|
||||||
* - \c ::ntokens is the number of tokens in the grammar.
|
* - \c ::ntokens is the number of tokens in the grammar.
|
||||||
* \post
|
* \post
|
||||||
* - \c ::states is of size \c ::nstates (which might be greater than
|
* - \c ::states is of size \c ::nstates (which might be greater than
|
||||||
|
|||||||
@@ -19,8 +19,7 @@
|
|||||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
|
|
||||||
/* Compute how to make the finite state machine deterministic; find
|
/* Find which rules need lookahead in each state, and which lookahead
|
||||||
which rules need lookahead in each state, and which lookahead
|
|
||||||
tokens they accept. */
|
tokens they accept. */
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|||||||
@@ -33,8 +33,7 @@
|
|||||||
|
|
||||||
/** Build the LALR(1) automaton.
|
/** Build the LALR(1) automaton.
|
||||||
|
|
||||||
Compute how to make the finite state machine deterministic; find
|
Find which rules need lookahead in each state, and which lookahead
|
||||||
which rules need lookahead in each state, and which lookahead
|
|
||||||
tokens they accept.
|
tokens they accept.
|
||||||
|
|
||||||
Also builds:
|
Also builds:
|
||||||
|
|||||||
@@ -97,15 +97,14 @@ main (int argc, char *argv[])
|
|||||||
nullable_compute ();
|
nullable_compute ();
|
||||||
timevar_pop (TV_SETS);
|
timevar_pop (TV_SETS);
|
||||||
|
|
||||||
/* Convert to nondeterministic finite state machine. In file LR0.
|
/* Compute LR(0) parser states. See state.h for more info. */
|
||||||
See state.h for more info. */
|
|
||||||
timevar_push (TV_LR0);
|
timevar_push (TV_LR0);
|
||||||
generate_states ();
|
generate_states ();
|
||||||
timevar_pop (TV_LR0);
|
timevar_pop (TV_LR0);
|
||||||
|
|
||||||
/* Make it deterministic by computing lookahead sets. Except when LALR(1) is
|
/* Add lookahead sets to parser states. Except when LALR(1) is
|
||||||
requested, split states to eliminate LR(1)-relative inadequacies. In file
|
requested, split states to eliminate LR(1)-relative
|
||||||
lalr and ielr. */
|
inadequacies. */
|
||||||
ielr ();
|
ielr ();
|
||||||
|
|
||||||
/* Find and record any conflicts: places where one token of
|
/* Find and record any conflicts: places where one token of
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* Type definitions for nondeterministic finite state machine for Bison.
|
/* Type definitions for the finite state machine for Bison.
|
||||||
|
|
||||||
Copyright (C) 2001-2007, 2009-2010 Free Software Foundation, Inc.
|
Copyright (C) 2001-2007, 2009-2010 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* Type definitions for nondeterministic finite state machine for Bison.
|
/* Type definitions for the finite state machine for Bison.
|
||||||
|
|
||||||
Copyright (C) 1984, 1989, 2000-2004, 2007, 2009-2010 Free Software
|
Copyright (C) 1984, 1989, 2000-2004, 2007, 2009-2010 Free Software
|
||||||
Foundation, Inc.
|
Foundation, Inc.
|
||||||
|
|||||||
Reference in New Issue
Block a user