mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
LR0: Documented the ::initialize algorithm
This commit is contained in:
parent
2a9000cfd0
commit
379c2f806e
1 changed files with 5 additions and 12 deletions
17
src/LR0.cpp
17
src/LR0.cpp
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue