diff --git a/examples/inc/README.txt b/examples/inc/README.txt new file mode 100644 index 0000000..6923b73 --- /dev/null +++ b/examples/inc/README.txt @@ -0,0 +1,9 @@ +There are two simple Turing Machine programs that increment a unary number. + +inc1 the most naïve possible implementation of incrementing a number by 1. + +incby takes two unary numbers and increment the second one by the value of the first one + +e.g.: 1101110… ⇒ 110111110… + +-- Vadim Zaytsev, http://grammarware.net diff --git a/examples/inc/inc1.ctur b/examples/inc/inc1.ctur new file mode 100644 index 0000000..f7aaf96 --- /dev/null +++ b/examples/inc/inc1.ctur @@ -0,0 +1,6 @@ +J06 +MF +J12 +W1 +MF + diff --git a/examples/inc/inc1.t_l2 b/examples/inc/inc1.t_l2 new file mode 100644 index 0000000..b173d4d --- /dev/null +++ b/examples/inc/inc1.t_l2 @@ -0,0 +1,8 @@ +J0 stop +L skip + MF + J1 skip + W1 + MF +L stop + diff --git a/examples/inc/incby.ctur b/examples/inc/incby.ctur new file mode 100644 index 0000000..5e5b31f --- /dev/null +++ b/examples/inc/incby.ctur @@ -0,0 +1,15 @@ +J015 +W0 +MF +J13 +MF +J15 +W1 +MB +J18 +MB +J110 +W1 +MF +J12 + diff --git a/examples/inc/incby.t_l2 b/examples/inc/incby.t_l2 new file mode 100644 index 0000000..7895027 --- /dev/null +++ b/examples/inc/incby.t_l2 @@ -0,0 +1,19 @@ +J0 stop +L incby + W0 + REP 2 { + L skip4 + MF + J1 skip4 + } + W1 + REP 2 { + L back3 + MB + J1 back3 + } + W1 + MF + J1 incby +L stop +