diff --git a/src/LR0.cpp b/src/LR0.cpp index f7b365b8..d6afd678 100644 --- a/src/LR0.cpp +++ b/src/LR0.cpp @@ -128,6 +128,20 @@ LR0::Closure LR0::getClosure (const std::string& symbol) const return result; } +//////////////////////////////////////////////////////////////////////////////// +void LR0::initializeFirstState (States& states) const +{ + LR0::Closure result; + for (unsigned int r = 0; r < _augmented.size (); ++r) + { + Item item (_augmented[r]); + item.setGrammarRuleIndex (r); + result.push_back (item); + } + + states.push_back (result); +} + //////////////////////////////////////////////////////////////////////////////// void LR0::closeState (States& states, const int state) const { diff --git a/src/LR0.h b/src/LR0.h index a4ad5262..3b0437dd 100644 --- a/src/LR0.h +++ b/src/LR0.h @@ -70,6 +70,7 @@ public: private: std::set getExpectedSymbols (const Closure&) const; Closure getClosure (const std::string&) const; + void initializeFirstState (States&) const; void closeState (States&, const int) const; private: