// reg.dfa machine coded for dfa simulation // // Machine Definition M = (Q, Sigma, alpha, q0, F) // Q = { q0, q1, q2, q3, q4 } the set of states // Sigma = { 0, 1 } the input string alphabet // q0 = q0 the starting state // F = { q2, q4 } the set of final states (accepting) // // inputs // alpha | 0 | 1 | // ---------+---------+---------+ // q0 | q3 | q1 | // q1 | q1 | q2 | // states q2 | q2 | q2 | // q3 | q4 | q3 | // q4 | q4 | q4 | // // L(M) is the notation for a Formal Language defined by a machine M. // Some of the shortest strings in L(M) = { 00, 11, 000, 001, 010, 101, 110, // 111, 0000, 00001, ... } // // The regular expression for the machine M above is // r = (1(0*)1(0+1)*)+(0(1*)0(0+1)*) // // See g_reg.g for equivalent regular grammar is constructed from M start q0 final q2 final q4 trace all limit 10 q0 0 q3 q0 1 q1 q1 0 q1 q1 1 q2 q2 0 q2 q2 1 q2 q3 0 q4 q3 1 q3 q4 0 q4 q4 1 q4 enddef tape 0110 tape 10100111 tape 0111 tape 1000