mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
LR0: Replaced old first-state init code
This commit is contained in:
parent
7126046049
commit
0d7c356bed
1 changed files with 4 additions and 13 deletions
17
src/LR0.cpp
17
src/LR0.cpp
|
@ -60,21 +60,12 @@ void LR0::initialize (const Grammar& grammar)
|
||||||
std::cout << "\n";
|
std::cout << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO The rest of this method is a work in progress. The goal is to create
|
// Initialize the first state.
|
||||||
// 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);
|
|
||||||
|
|
||||||
States states;
|
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);
|
closeState (states, 0);
|
||||||
std::cout << states.dump () << "\n";
|
std::cout << states.dump () << "\n";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue