Turing machine compiler

a+b=b+a
this is a short “tm a+b” program or “source code” to be compiled by the vzn TM compiler that shows off a few of its features. the 1st version was built around ~2003. it verifies the commutative law of addition for naturals. by multiple nested loops it enumerates all pairs (a, b), b \leq a in lexocographical order and verifies that a+b = b+a. it halts if they are found to be not equal. capitalized lines are program branching labels. the computation is in binary. addition of two binary numbers is not directly supported. the language has INCrement and DECrement commands that work in binary.
tmc tm compiler/ruby
this is the ruby code “tmc” to compile the TM. it was tested in ruby v1.9.3-p286. caveat: “quick and dirty”
tm a+b object code
this is the compiled TM output of the “tm a+b” program ie the “object code” with 122 states. it outputs explanatory/descriptive labels that show the “substate” in a sequence of states associated with a particular command.
TM simulator/ruby
TM simulator that takes the object code and runs the program. input state starts with the empty tape. underlines signify blank squares.
a+b TM run dmode=1 steps=100000
this is a run with dmode=1 where the TM outputs its own info (ie internal variables & state) with “print” commands. here it is outputting at the outer loop the current pair (a,b) followed by the TM ID step # and ID (instantaneous description), eventually reaching (10,7) pair at the end at step 97276.
a+b TM run dmode=0 steps=5000
a run with dmode=0 where verbose debugging info on exact TM ID and state descriptions is output. reaches and is interrupted at pair (4,4)
a+b TM run dmode=2 steps=5000
dmode=2 is similar to dmode=0 except with no interspersed description lines, just the “straight” TM ID tableau.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s