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
// The sets-of-items construction:
//
// procedure items(G');
// begin
// 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
// Given a grammar:
// - Obtain the augmented grammar
// - Create the first state from the first augmented grammar rule
// - Expand the first state
// - Recursively create and expand all the other states
void LR0::initialize (const Grammar& grammar)
{
// Obtain the augmented grammar.