mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
LR0: Documented closure algorithm
This commit is contained in:
parent
f27d66b8c7
commit
58c62eed5b
1 changed files with 15 additions and 0 deletions
15
src/LR0.cpp
15
src/LR0.cpp
|
@ -78,11 +78,26 @@ void LR0::initialize (const Grammar& grammar)
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Aho/Sethi/Ullman, p223
|
||||
//
|
||||
// function closure (I);
|
||||
// begin
|
||||
// J := I;
|
||||
// repeat
|
||||
// for each item A --> alpha . B beta in J and each production
|
||||
// B --> gamma of G such that B -> . gamma is not in J do
|
||||
// add B --> . gamma to J
|
||||
// until no more items can be added to J;
|
||||
// return J
|
||||
// end
|
||||
LR0::Closure LR0::getClosure (
|
||||
const Item& item,
|
||||
const std::vector <std::vector <std::string>>& augmented)
|
||||
{
|
||||
LR0::Closure closure;
|
||||
closure.push_back (item);
|
||||
|
||||
// TODO Add the rest
|
||||
|
||||
return closure;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue