tm simulation, simulation code cleanup

This commit is contained in:
Parker TenBroeck 2026-01-12 23:34:06 -05:00
parent 7f519cd7f3
commit 2a777f3198
8 changed files with 460 additions and 266 deletions

View file

@ -163,6 +163,30 @@ d(q0, epsilon, B) = { (q1, B) }
d(q1, a, A) = { (q1, epsilon) }
d(q1, b, B) = { (q1, epsilon) }`,
),
new Example("TM", "a^nb^n",
`// accepts all strings on {a,b}+ of the form anbn
type = TM
Q = { q0, q1, q2, q3, q4 } // set of internal states
F = { q4 } // set of final states
T = { a, b, X, Y, B } // tape alphabet
B = B // the blank symbol (tape initializer symbol)
q0 = q0 // initial state
d(q0,a)=(q1,x,R)
d(q1,a)=(q1,a,R)
d(q1,Y)=(q1,y,R)
d(q1,b)=(q2,y,L)
d(q2,Y)=(q2,y,L)
d(q2,a)=(q2,a,L)
d(q2,X)=(q0,x,R)
d(q0,Y)=(q3,y,R)
d(q3,Y)=(q3,y,R)
d(q3,B)=(q4,B,R)
`)
];
const CATEGORY_ORDER: Category[] = [