Question: Enter a regular expression: ( aa + bb ) * aaa Traceback ( most recent call last ) : File C: Users

Enter a regular expression: (aa+bb)*aaa
Traceback (most recent call last):
File "C:\Users\Jimbo\RE2DFA.py", line 12, in
dfa = re_to_dfa(re_string)
^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Jimbo\RE2DFA.py", line 7, in re_to_dfa
dfa = DFA(tree, num_positions)
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Jimbo\DFA.py", line 5, in __init__
self.build_dfa(root)
File "C:\Users\Jimbo\DFA.py", line 9, in build_dfa
self.compute_followpos(root, followpos)
File "C:\Users\Jimbo\DFA.py", line 15, in compute_followpos
followpos[pos]= followpos[pos].union(node.rchild.firstpos)
~~~~~~~~~^^^^^
IndexError: list index out of range. this doesn't even compile, please give code that works. The original question isn't answered correctly does not give the correct output, i need code that compiles and outputs the correct output

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 Programming Questions!