=
One command, the equals sign. Storing into place 0 is how it prints.
2018 · Turing complete: no · ●○○ easy · esolangs.org
Tested with 2 known programs · Test method
Run it
The idea
= is a language from 2018 whose only command is =. A line 4=+123 puts 123 into place 4. When the left side carries a sign, as in +143=-12, the line is a test instead, and a true test jumps forward. Printing has no command of its own. Anything stored into place 0 also comes out as a character.
Read the story
The specification describes the test as a look at the place assigned most recently. The Python interpreter on the specification does something else. It compares the place named on the left with the value on the right, and when they are equal it jumps forward by that value. This implementation follows the interpreter.
The machine
| Line | Does |
|---|---|
4=+123 | Put 123 into place 4 |
4=7 | Put the value of place 7 into place 4 |
0=+72 | Print character 72, an H, and keep it in place 0 |
+5=+2 | If place 5 holds 2, jump forward 2 lines, else go on |
+5=7 | The same with the value of place 7 |
A line without exactly one = is skipped, and the program ends after its last line. A jump of 0 stays on its line for ever, and a jump back past the first line counts from the end, as a Python list does. A jump back further than the program is long finds no line at all, so the interpreter moves on one step at a time until it reaches the first line. There is no arithmetic, and every place and value is written in the program, so a program has only finitely many states.
Example
The example, XKCD Random Number, is a random number chosen by a fair dice roll.
The example, XKCD Random Number, is a random number chosen by a fair dice roll.
Place 1 holds 2, so +1=+2 jumps forward two lines, over the N, and only the Y is printed.
Patterns it teaches
- One instruction: one command that both stores and jumps, though with no arithmetic it cannot count.
Further
See also
Also in Turing tarpits
Write your own in Run Convert a program from =
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: u3d.
Command line
shib run u3d -e '0=+52'shib manual u3dSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/u3d.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org