Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; Machine starts in state q0
- ; State 0: change leftmost a symbol to _
- 0 _ * r 0
- 0 a _ * q1
- 0 b * * halt-reject
- 0 c * * halt-reject
- ; State q1: Move to the right until first b is found
- q1 _ * r q1
- q1 a * r q1
- q1 b x * q2
- q1 x b * q5
- q1 c * * halt-reject
- ; State q2: Move to the rightmost c
- q2 x * r q2
- q2 b * r q2
- q2 c * r q2
- q2 _ * l q3
- ; State q3: delete rightmost c then move to the left,
- q3 c _ * q3
- q3 _ * l q4
- q3 b * l q3
- q3 x * r q1
- ; State q4: check if there is a b, if not first check of _
- q4 c * l q4
- q4 b * l q3
- q4 x * l q4
- q4 a * l q5
- q4 _ * r q9
- ; State q5: check if there is an a, if so repeat the loop but now b->x
- q5 a * l q5
- q5 _ * r 0
- q5 b * r q5
- q5 x * r q5
- q5 c * r q6
- ; State q6: find the rightmost c with loop x->b
- q6 c * r q6
- q6 _ * l q7
- ; State q7: delete rightmost c, also find an x to change it to b
- q7 c _ * q7
- q7 _ * l q8
- q7 x * l q7
- q7 b * r q1
- ; State q8: move to the left until one a is found, also double-check x
- q8 c * l q8
- q8 x * l q7
- q8 b * l q8
- q8 a a * q5
- q8 _ * r q9 ; There are no more a's, check is zero c's aswell
- ; State q9: check if there are no c's, if so, string is accepted
- q9 b * r q9
- q9 x * r q9
- q9 _ * * halt-accept
- q9 c * * halt-reject
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement