Do is a fictive machine language that reads, writes and jumps on a tape, working like a Turing machine.
A Do programm is a particular serial alignment of 0
and 1
bits, stored on a so-called tape. These values are grouped into sections called buts, each consisting of 2 command bits and 8 address bits. The address part of a but is the binary representaion of a position on the tape. Additionally, a Do machine has single bit storage, comparable to a register of a CPU; The Do programm can read into the storage and write from it onto the tape.
Do provides the following 4 commands:
command | address | effect |
---|---|---|
0 0 |
0 0 0 0 1 0 1 0 |
Read the bit at position 10 from the tape into the storage. |
0 1 |
0 0 0 0 1 0 0 1 |
Write the bit from the storage to position 9 on the tape. |
1 0 |
0 0 0 0 0 1 1 1 |
Jump to position 7 on the tape. |
1 1 |
0 0 0 0 0 0 0 0 |
Jump to position 0 if the content of the storage is 1 . |
Do code can be executed by the Do runtime, an open-source runtime written in JavaScript. The execution will terminate when the program jumps to the end of the tape (or beyond).