Question: There is a bug with the MachineModelNFA code, which is demonstarted with the following implementation of the language (()())((ab)(bb)). I know there is a bug

There is a bug with the MachineModelNFA code, which is demonstarted with the following implementation of the language (()())((ab)(bb)).

I know there is a bug after the second epslion move which is why the test can't be completed. But I am not sure how should I fix the bug. If someone can give an idea on to fix it, it would be great!

nfa_ec = { 'states': ['S0','S1','E0','E1','E2','E3','F0','F1','F2','F3',], 'alphabet': ['a','b'], 'transitions': { ('S0',':'):['S1'],('S1',':'):['E0','F0'], ('E0',':'):['E1'],('E1','a'):['E2'],('E2','b'):['E3'],('E3',':'):['S0'], ('F0',':'):['F1'],('F1','b'):['F2'],('F2','b'):['F3'],('F3',':'):['S0'] }, 'start': 'S0', 'accept': ['S0','E0','F0','E3','F3'] }

nfa_test = [None for i in range(5)]

nfa_test = [ ('',True), ('ab',True), ('bb',True), ('aa',False), ('ba',False), ('abab',True), ('abbb',True), ('bbab',True), ('bbbb',True), ('abaa',False), ('bbba',False), ('aaaa',False), ('aaab',False), ]

tm = TestMachineNFA(nfa_ec) tm.run(nfa_test)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!