LR0: Added framework around ::getClosure method (unimplemented)

This commit is contained in:
Paul Beckingham 2015-12-28 11:34:28 -05:00
parent b1c85adfe4
commit aec497e4c8
2 changed files with 10 additions and 15 deletions

View file

@ -55,25 +55,20 @@ void LR0::initialize (const Grammar& grammar)
std::cout << "\n"; std::cout << "\n";
} }
// Add all items from augmented grammar, in initial state: // TODO Add all items from augmented grammar, in initial state:
// A --> . B .... // A --> . B ....
/* Item item0 {augmented[0]};
LR0::Closure closure; std::cout << item0.dump () << "\n";
for (unsigned int i = 0; i < augmented.size (); ++i) auto closure = getClosure (item0, augmented);
closure.push_back (LR0::Item (i, 0));
LR0::States states; States states;
states.push_back (closure); 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; LR0::Closure closure;

View file

@ -61,7 +61,7 @@ public:
}; };
private: private:
Closure getClosure (Item&); Closure getClosure (const Item&, const std::vector <std::vector <std::string>>&);
private: private:
// state column result // state column result