py.dfa running and opening labc.dfa file opened // labc.dfa machine coded for dfa simulation // // Machine Definition M = (Q, Sigma, alpha, q0, F) // Q = { q0, q1, q2, q3 } the set of states // Sigma = { a, b, c } the input string alphabet // q0 = q0 the starting state // F = { q3 } the set of final states (accepting) // // inputs // alpha | a | b | c | // ---------+---------+---------+---------+ // q0 | q1 | phi | phi | phi is no state exists // q1 | phi | q2 | phi | // states q2 | phi | phi | q3 | // q3 | phi | phi | phi | // // // The regular expression for the machine M above is // r = abc just one string // start q0 final q3 trace all limit 10 q0 a q1 // no typing for transition to phi q1 b q2 q2 c q3 enddef end of DFA definition tape abc tape acb tape bbb input file read start state is: q0 limit on transitions is: 10 states: q0 q3 q1 q2 final states: q3 trace states: trace_all= 1 to states: q1 q2 q3 from states: q0 q1 q2 sigma symbols: a b c transitions: q0 a q1 q1 b q2 q2 c q3 input tapes: [abc] [acb] [bbb] main simulation loop for each input tape DFA running on input tape: [abc] tl= 4 in state= q0 tape head at k= 1 ts= a q0 a q1 in state= q1 tape head at k= 2 ts= b q1 b q2 in state= q2 tape head at k= 3 ts= c q2 c q3 input tape accepted DFA running on input tape: [acb] tl= 4 in state= q0 tape head at k= 1 ts= a q0 a q1 in state= q1 tape head at k= 2 ts= c transition not found for q1 l= 2 c l= 1 tape not accepted DFA running on input tape: [bbb] tl= 4 in state= q0 tape head at k= 1 ts= b transition not found for q0 l= 2 b l= 1 tape not accepted no more input tapes dfa.py finished