I make a DFA Simulator.
if Node 0 is initial state and Node 3 is final state, like weight graph implementation.
char CurrentStateAccept[stateN][alphabetN][alphabetN] = { {"01"} , {"0"} , {"0","1"} ,{} }; // 0, 1, 2, 3
int NextState[stateN][alphabetN] = {{1},{2},{0,3},{}};
I want to get 1, 1, 2, 0
- node 0, accept(0 or 1) -> node 1
- node 1, accept(0) -> node 2
- node 2, accept(0) -> node 0
- node 2, accept(1) -> node 3
- and node 3 is final state of dfa.
so I want to get char CurrentStateAccept[each state]'s element number for using 'for loop' ex)
for(i=0; i<currentState element num; i++)
{
for(j=0; j<end of alphabet of each element; j++)
{
there is acceptable state? or not?
}
}
How can I get in C?