You are on page 1of 3

Turing machine For Even palindrome over {0,1}

state = q[0]
while(TRUE)
do
switch(state)
do
case q[0]:
switch(current read symbol)
do
case 0:
write (b);
state = q[];
mo!ement (ri"ht);
brea#;
case :
write (b);
state = q[$];
mo!ement (ri"ht);
brea#;
case b:
write (b);
state = q(acce%t);
mo!ement (ri"ht);
brea#;
end;
brea#;
case q[]:
switch(current read symbol)
do
case 0:
write (0);
state = q[];
mo!ement (ri"ht);
brea#;
case :
write ();
state = q[];
mo!ement (ri"ht);
brea#;
case b:
write (b);
state = q[&];
mo!ement (le't);
brea#;
end;
brea#;
case q[&]:
switch(current read symbol)
do
case 0:
write (b);
state = q[(];
mo!ement (le't);
brea#;
case :
write (0);
state = q(re)ect);
mo!ement (ri"ht);
brea#;
case b:
write (0);
state = q(re)ect);
mo!ement (ri"ht);
brea#;
end;
brea#;
case q[(]:
switch(current read symbol)
do
case 0:
write (0);
state = q[(];
mo!ement (le't);
brea#;
case :
write ();
state = q[(];
mo!ement (le't);
brea#;
case b:
write (b);
state = q[0];
mo!ement (ri"ht);
brea#;
end;
brea#;
case q[$]:
switch(current read symbol)
do
case 0:
write (0);
state = q[$];
mo!ement (ri"ht);
brea#;
case :
write ();
state = q[$];
mo!ement (ri"ht);
brea#;
case b:
write (b);
state = q[*];
mo!ement (le't);
brea#;
end;
brea#;
case q[*]:
switch(current read symbol)
do
case 0:
write (0);
state = q(re)ect);
mo!ement (ri"ht);
brea#;
case :
write (b);
state = q[(];
mo!ement (le't);
brea#;
case b:
write (0);
state = q(re)ect);
mo!ement (ri"ht);
brea#;
end;
brea#;
case q(acce%t):
acce%t();
case q(re)ect):
re)ect();
end
end

You might also like