dual tape ez
The easy one. Every cell holds a letter for what it does and a number to do it with.
Charles McMarrow, 2021 · Turing complete: yes · ●●○ moderate · esolangs.org
Tested with 2 known programs · Test method
Run it
The idea
Charles McMarrow made dual tape ez in 2021, as the sister language of dual tape. Both have the same seventeen rules and the same memory, a tape from minus infinity to infinity whose every cell holds an instruction and a number. In dual tape a program has to turn a dial to reach a rule. Each rule has its own letter, so a program reads almost like an assembler with two registers, item_1 and item_2.
Read the story
The program is its own data. Its Hello World keeps the text in the number fields of 14 cells, and a pointer to them in the number field of the w that moves it on.
The machine
| Letter | Does |
|---|---|
h | Halt |
n c | Print item_1 as a number or as a UTF-8 character |
i o | Read a number or a character into item_1 |
a s | item_1 becomes item_2 plus or minus item_1 |
j k | Jump to this cell's number, or to the number in the cell item_1 names |
z g | Jump to item_1 when item_2 is 0, or 0 or more |
r t y | item_2 takes item_1; item_1 takes this cell's number, or the number or letter in the cell item_1 names |
w e d | Store item_1 in this cell, or item_2 in the cell item_1 names, as a number or a letter |
. | Nothing |
A line is an optional @label, the letter and an optional number, which is a label, an integer or c and one character for its code. The run starts at the label @. Cells past the program hold . and 0. A letter read as a number is its character code, a choice the specification leaves open.
Example
Add two numbers.
Add two numbers. r moves the first into item_2 before i reads the second.
The truth machine. r @zero puts the address of @zero in item_1 and the input in item_2, and z jumps there on 0. On 1 it prints 1 for ever.
The Hello World. t twice follows the pointer in @ptr to a character, z stops at the 0 after the text, and w stores the pointer plus 1 back into its own cell.
Patterns it teaches
- Self-modifying code:
wanddrewrite the cells the program runs from. - Code as data: the text, the pointer and the code share one tape.
Further
See also
Self-modifying
Cell-based
Write your own in Run Convert a program from dual tape ez
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: dual-tape-ez.
Command line
shib run dual-tape-ez -e '@ i # Truth Machine
r @zero
z
@one_loop r 1
n
j @one_loop
@zero r 0
n
h' --input '0'shib manual dual-tape-ezSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/dual-tape-ez.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org