Initialization. We need to be able to generate any string of the form
#...#$xqfy#...#
Since we need an arbitrary number of "blanks" on either side, we use the
productions
S
#S | S# | $A
(The $ is a marker we will use later.) Next we use the A to generate the strings
x, y
,
with a state qf somewhere in the middle:
A
sA
| As | qf, for all s
.
Execution. For each transition rule of
we need a corresponding production. For each rule of the form
(qi,
a) = (qj, b, R)
we use a production
bqj
qia
and for each rule of the form
(qi,
a) = (qj, b, L)
we use a production
qjcb
cqia
for every c
(the asymmetry is because
the symbol to the right of q is the one under the Turing machine's
tape head.)
Cleanup. We end up with a string that looks like #...#$q0w#...#,
so we need productions to get rid of everything but the w:
#
![]()
$q0
Copyright © 1996 by David Matuszek
Last modified Apr 8, 1996