mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
LR0: Added framework around ::getClosure method (unimplemented)
This commit is contained in:
parent
b1c85adfe4
commit
aec497e4c8
2 changed files with 10 additions and 15 deletions
23
src/LR0.cpp
23
src/LR0.cpp
|
@ -55,25 +55,20 @@ void LR0::initialize (const Grammar& grammar)
|
|||
std::cout << "\n";
|
||||
}
|
||||
|
||||
// Add all items from augmented grammar, in initial state:
|
||||
// TODO Add all items from augmented grammar, in initial state:
|
||||
// A --> . B ....
|
||||
/*
|
||||
LR0::Closure closure;
|
||||
for (unsigned int i = 0; i < augmented.size (); ++i)
|
||||
closure.push_back (LR0::Item (i, 0));
|
||||
LR0::States states;
|
||||
Item item0 {augmented[0]};
|
||||
std::cout << item0.dump () << "\n";
|
||||
auto closure = getClosure (item0, augmented);
|
||||
|
||||
States states;
|
||||
states.push_back (closure);
|
||||
*/
|
||||
// Iteratively expand non-terminals until there are no more.
|
||||
/*
|
||||
int state = 0;
|
||||
while (expandNonTerminals (augmented, states, state))
|
||||
;
|
||||
*/
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
LR0::Closure getClosure (LR0::Item& item)
|
||||
LR0::Closure LR0::getClosure (
|
||||
const Item& item,
|
||||
const std::vector <std::vector <std::string>>& augmented)
|
||||
{
|
||||
LR0::Closure closure;
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ public:
|
|||
};
|
||||
|
||||
private:
|
||||
Closure getClosure (Item&);
|
||||
Closure getClosure (const Item&, const std::vector <std::vector <std::string>>&);
|
||||
|
||||
private:
|
||||
// state column result
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue