Idego
One instruction per line. Add to a cell, then jump if the cell holds the right number.
ChuckEsoteric08 · Turing complete: yes · ●○○ easy · esolangs.org
Tested with 3 known programs · Test method
Run it
The idea
ChuckEsoteric08 made Idego, whose name stands for increment, decrement, goto. It is a one instruction set computer. Every line adds a number to a cell and may then jump to another line, depending on what the cell holds. Two words can take the place of the number. IN reads a character into the cell and OUT prints the cell as a character.
Read the story
The specification calls Idego Turing complete, because every brainfuck program converts to it easily.
The machine
| Line | Does |
|---|---|
a b | Add a to cell b |
a b c | Add a to cell b, then go to line c if the cell is not 0 |
a b c d | Add a to cell b, then go to line c if the cell holds d |
IN b | Read a character into cell b instead of adding |
OUT b | Print cell b as a character instead of adding |
IN and OUT take the same jumps as a number does. Lines count from 1. Cells hold whole numbers without bound and start at 0. A jump to a line that does not exist ends the run, and so does the end of the program. At the end of the input IN reads 0.
Example
The Hello World walks one cell from letter to letter, 27 lines for 13 characters.
The Hello World walks one cell from letter to letter, 27 lines for 13 characters.
The truth machine. On 0 line 2 jumps to the last OUT and the run ends. On 1 line 4 jumps back to line 3 forever.
A countdown. Cell 2 counts five passes, and line 5 jumps back while it is not 0.
The cat is two lines, IN 1 and OUT 1 1. It copies characters until it reads a 0, which it prints before it stops.
Patterns it teaches
- One instruction: one line shape does arithmetic, input, output and branching.
- Turing tarpit: any number of cells and a conditional jump are enough.
Further
See also
OISC
Cell-based
Write your own in Run Convert a program from Idego
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: idego.
Command line
shib run idego -e 'IN 1
OUT 1 1' --input 'Idego '