mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
LR0: Removed ::getClosure, it's form is wrong
This commit is contained in:
parent
819beb5909
commit
71d216ea49
2 changed files with 0 additions and 33 deletions
32
src/LR0.cpp
32
src/LR0.cpp
|
@ -85,38 +85,6 @@ void LR0::initialize (const Grammar& grammar)
|
|||
// TODO Now recursively fill in the rest.
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// 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 Closure& items) const
|
||||
{
|
||||
LR0::Closure closure;
|
||||
for (auto& item : items)
|
||||
{
|
||||
// closure(I) includes I.
|
||||
closure.push_back (item);
|
||||
|
||||
// Obtain all the expected symbols.
|
||||
for (auto& exp : getExpected (items))
|
||||
{
|
||||
std::cout << "# Expecting " << exp << "\n";
|
||||
std::cout << "# Add expansion of " << exp << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
return closure;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Collect a unique set of expected symbols from the closure.
|
||||
std::set <std::string> LR0::getExpected (const Closure& closure) const
|
||||
|
|
|
@ -68,7 +68,6 @@ public:
|
|||
};
|
||||
|
||||
private:
|
||||
Closure getClosure (const Closure&) const;
|
||||
std::set <std::string> getExpected (const Closure&) const;
|
||||
Closure expand (const std::string&) const;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue