Skip to content

Commit b4d0a57

Browse files
committed
Add binary increment example
1 parent 6dd31d2 commit b4d0a57

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

examples/binary_increment.tau

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Implements a simple binary incrementer
2+
3+
symbols = 0,1,x
4+
blank = x
5+
start = FIND_END
6+
end = HALT
7+
8+
# The tape can be any binary number
9+
tape = 1,0,0,0,1
10+
11+
------
12+
13+
FIND_END {
14+
x = x, LEFT, ADD_ONE
15+
0 = 0, RIGHT, FIND_END
16+
1 = 1, RIGHT, FIND_END
17+
}
18+
19+
ADD_ONE {
20+
0 = 1, STAY, HALT
21+
1 = 0, LEFT, ADD_ONE
22+
x = 1, STAY, HALT
23+
}

0 commit comments

Comments
 (0)