LR0: Documented the ::initialize algorithm

This commit is contained in:
Paul Beckingham 2016-01-03 16:42:13 -05:00
parent 2a9000cfd0
commit 379c2f806e

View file

@ -35,18 +35,11 @@ LR0::LR0 ()
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Aho/Sethi/Ullman, p224 // Given a grammar:
// The sets-of-items construction: // - Obtain the augmented grammar
// // - Create the first state from the first augmented grammar rule
// procedure items(G'); // - Expand the first state
// begin // - Recursively create and expand all the other states
// C := {closure ({[S' --> . S]})};
// repeat
// for each set of items I in C and each grammar symbol X such that
// goto (I, X) is not empty and not in C do
// add goto (I, X) to C
// until no more sets of items can be added to C
// end
void LR0::initialize (const Grammar& grammar) void LR0::initialize (const Grammar& grammar)
{ {
// Obtain the augmented grammar. // Obtain the augmented grammar.