Consider the following encoding of an NFA:
<number_of_states> <list_of_chars_in_alphabet> <list_of_final_states> <state> <symbol> <list_of_states>
Example:
9 a b 4 0 EPS 1 0 a 5 0 b 0 1 EPS 2 1 b 3 5 2 EPS 4 2 a 2 3 3 a 3 3 b 3 4 EPS 4 7 8 5 a 6 5 b 5 6 EPS 7 6 a 6 7 EPS 6 7 b 4
You'll find in nfa_skel.rar a class that already reads the input and forms the NFA.
Also, you can use the graphvizNFA method to get a graphical representation of the NFA, but you will have to install the graphviz library.
pip install graphviz
Implement (in Python) an NFA class that supports the following methods:
1. step(configuration)
2. kstep(configuration, k)
3. accept(self, word: Word)
4. epsilonClosure(self, state: State)
5. emptyLanguage(self)