Question: dfa.py: Write a program that reads a description of a deterministic finite automaton (DFA) and then classifies input strings as accepted or rejected by the


dfa.py: Write a program that reads a description of a deterministic finite automaton (DFA) and then classifies input strings as accepted or rejected by the DFA DFAs are characterized by the following 5-tuple: (Q,, , qo, F), where Q denotes the set of states, is the alphabet of possible input symbols, is the set of transition rules, qo is the start state, and F is the set of final (accepting) states Input to the program will be a DFA specification followed by a number of input strings. For each input string, you should print "accepted" or "rejected". Example DFA: Example DFA 91 startgo 42 (3 Corresponding input, including input test strings: states: g0 q1 q2 q3 symbols: a b c begin_rules go -> ql on a q1 -> q2 on b q0 ->q2 on c qi -> ql on a qo ->q3 on b end_rules start: g0 final: q2 g3 ab cba # " aaa # " aaab # prints "accepted" # prints "accepted" prints "rejected prints "rejected
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
