RegLike
Five commands on numbered registers. Take one away or jump, and that is enough.
HadiMakesCodes, 2026 · Turing complete: yes · ●○○ easy · esolangs.org
Tested with 5 known programs · Test method
Run it
The idea
HadiMakesCodes made RegLike in 2026, after Subleq, Addleq, Muxleq and Marvin Minsky's register machine. A program is one command per line, and lines count from 1. Registers hold whole numbers and start at 0. The only test is the one Minsky's machine has. It takes 1 away from a register, or jumps when there is nothing left to take.
The machine
| Line | Does |
|---|---|
r n | If register r is 0 jump to line n, else take 1 from it |
r | Add 1 to register r |
r=v | Set register r to the number v |
r=i | Set register r to a number from the input |
a r0 r1 ... | Output each register as the character with that code |
A jump to a line that is empty or past the last one halts. The examples put comments after ;, and this implementation takes them too.
Example
The truth machine.
The truth machine. Line 6 sends a 0 to line 11, which prints the 48 in register 2. A 1 goes on, and lines 8 to 10 print register 1 until register 4 has counted down from 99. Register 3 stays 0, so 3 8 always jumps.
The addition moves register 0 into register 1 one at a time and ends by jumping to line 7. It prints nothing, so a seventh line prints register 1. 50 and 15 make 65, an A.
The If Statements example says it prints A for 0 and B for 1. Run by its own rules it does the reverse, and so does this implementation.
Patterns it teaches
- Counter machines: add one, take one away, jump on 0.
- Turing tarpit: five commands, one of them a test.
Further
See also
Also in Turing tarpits
Write your own in Run Convert a program from RegLike
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: reglike.
Command line
shib run reglike -e '0=i
1=i
2=0
0 7
1
2 3' --input '2 5'shib manual reglikeSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/reglike.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org