Skip to content

Commit

Permalink
multiplication
Browse files Browse the repository at this point in the history
  • Loading branch information
grammarware committed Jun 20, 2012
1 parent 792b4ce commit 5f31784
Show file tree
Hide file tree
Showing 3 changed files with 136 additions and 0 deletions.
5 changes: 5 additions & 0 deletions examples/mult/README.txt
@@ -0,0 +1,5 @@
This is a somewhat complicated Turing Machine program that performs multiplication of two unary numbers.

You should be able to understand it with relative easy, once you have a look at other examples (in particular, copy and incby).

-- Vadim Zaytsev, http://grammarware.net
58 changes: 58 additions & 0 deletions examples/mult/mult.ctur
@@ -0,0 +1,58 @@
J058
W0
MF
J13
MF
J_7
W0
MF
J18
MF
J110
W1
MB
J113
MB
J115
W1
MF
J021
J17
MB
J121
MB
J123
W1
MF
J058
W0
MF
J129
MF
J053
W0
MF
J134
MF
J136
W1
MB
J139
MB
J141
W1
MF
J133
MB
J146
MB
J148
W1
MF
J128
MF
MF
J154
MF
J156

73 changes: 73 additions & 0 deletions examples/mult/mult.t_l2
@@ -0,0 +1,73 @@
J0 stop
W0
L skip
MF
J1 skip
MF
J_ copy
L copy
W0
REP 2 {
L skip2
MF
J1 skip2
}
W1
REP 2 {
L back
MB
J1 back
}
W1
MF
J0 end
J1 copy
L end
REP 2 {
L back2
MB
J1 back2
}
W1
MF
J0 stop
L mainloop
W0
L skip3
MF
J1 skip3
MF
J0 exit
L incby
W0
REP 2 {
L skip4
MF
J1 skip4
}
W1
REP 2 {
L back3
MB
J1 back3
}
W1
MF
J1 incby
REP 2 {
L back4
MB
J1 back4
}
W1
MF
J1 mainloop
L exit
MF
REP 2 {
L skip5
MF
J1 skip5
}
L stop

0 comments on commit 5f31784

Please sign in to comment.