trueclone
Twelve upper-case words and binary numbers, with no spaces, and every jump aimed at a character.
2020 · Turing complete: yes · ●●○ moderate · esolangs.org
Tested with 3 known programs · Test method
Run it
The idea
trueclone was made in 2020 to write spaghetti code. A program is one run of upper-case instructions with nothing between them. A parameter is a binary number written straight after its instruction, so the only other symbols are 0 and 1. There are no comments and no spaces.
Read the story
Jumps do not go to a label or a line. They go to a character of the source, counted from 0. Change the length of one parameter and every jump after it lands somewhere else.
The machine
| Instruction | Does |
|---|---|
ADD SUB SET n | Add, subtract or set the cell; cells are signed 16 bits |
LEFT RIGHT | Move to the next cell; the specification has LEFT move right |
IN OUT | Read a character code; print the cell as a character |
JUMP n | Go to character n of the source |
JINZ JITS n | Jump when the cell is not 0; when it is 0 |
JINN JITN n | Jump when the cell is below 0; when it is above 0 |
The specification's table swaps the two moves, and its proof of Turing completeness swaps them the same way. At the end of the input IN gives 0, and the run ends at the end of the source.
Example
The truth machine prints its input.
The truth machine prints its input. On 0 the cell is 0 after SUB110000, which subtracts 48, and JITS jumps to character 66, the end of the program. On 1 it loops back to the OUT at character 43 and prints 1 forever.
Printing text means setting a cell to each code. 1001000 is 72, an H, and 1101001 is 105, an i.
The cat is INOUTJINZ0. It jumps back to character 0 as long as the byte it read is not 0.
Patterns it teaches
- Turing tarpit: the specification maps brainfuck onto
ADD,SUB, the two moves and a conditional jump.
Further
See also
Cell-based
Write your own in Run Convert a program from trueclone
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: trueclone.
Command line
shib run trueclone -e 'INOUTJINZ0' --input 'cat '