LR0: Replaced old first-state init code

This commit is contained in:
Paul Beckingham 2016-01-05 01:16:07 -05:00
parent 7126046049
commit 0d7c356bed

View file

@ -60,21 +60,12 @@ void LR0::initialize (const Grammar& grammar)
std::cout << "\n";
}
// TODO The rest of this method is a work in progress. The goal is to create
// recursive tools to completely build the LR parsing table.
Item item0 {_augmented[0]};
item0.setGrammarRuleIndex (0);
Closure items;
items.push_back (item0);
for (auto& expected : getExpectedSymbols (items))
for (auto& item : getClosure (expected))
items.push_back (item);
// Initialize the first state.
States states;
states.push_back (items);
initializeFirstState (states);
std::cout << states.dump () << "\n";
// TODO Now recursively fill in the rest.
// Recursively fill in the rest.
closeState (states, 0);
std::cout << states.dump () << "\n";
}