esolang

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

Expected: Hello, World!

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

LineDoes
a bAdd a to cell b
a b cAdd a to cell b, then go to line c if the cell is not 0
a b c dAdd a to cell b, then go to line c if the cell holds d
IN bRead a character into cell b instead of adding
OUT bPrint 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.

Expected: 0

A countdown. Cell 2 counts five passes, and line 5 jumps back while it is not 0.

Expected: 54321

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

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'
shib manual idego

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/idego.js

Docs: Kernel instructions · The .shib format · Command line · Adding a language

Source esolangs.org (CC0) · Edit on esolangs.org