esolang

JUMP

Three commands on numbered lines. A line may print a bit, may read a bit, and always jumps.

EzoLang, 2009 · Turing complete: no · ●○○ easy · esolangs.org

Tested with 5 known programs · Test method

Run it

Expected: 0

The idea

EzoLang made JUMP in 2009. A program is a list of numbered lines, and the only state is which line runs. Input and output are single bits. With no memory beyond the line number, the specification notes that every JUMP program can be turned into a finite automaton, so it is not Turing complete.

Read the story

The specification also gives a binary form, where each line is one block of bits.

The machine

LineDoes
N GOTO yJump to line y
N IF x THEN GOTO y ELSE GOTO zRead a bit; jump to y if it is x, else to z
N OUTPUT x GOTO yPrint the bit x, then jump
N OUTPUT x IF x THEN GOTO y ELSE GOTO zPrint, then read and jump

Jumping to a line that is not there stops the program. The run starts at line 0. The specification does not say what happens when the input runs out; reading past its end stops the run.

In the binary form each block has five pieces.

PieceMeans
A1 for IF, 0 for GOTO
BWhere to go on a 0, or where GOTO goes
CWhere to go on a 1; all ones in a GOTO block halts
D1 when the line prints
EThe bit to print

B and C are as wide as the line numbers need. A program of 3 or 4 lines uses 2 bits for each, so its blocks are 7 bits long.

Example

The truth machine.

The truth machine. On 0 it prints 0 and jumps to line 3, which is not there. On 1 it prints 1 forever.

The same program in the binary form, three blocks of 7 bits.

Expected: 0

Cat in the binary form copies bits until the input runs out. Its fourth block, 0001100, is a halt that no jump reaches.

Expected: 0110

The 2 bit counter has 8 lines and prints 00, 01, 10, 11 over and over without stopping.

Further

Also in Turing tarpits

Write your own in Run Convert a program from JUMP

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: jump.

Command line

shib run jump -e '110010000100110110010' --input '0'
shib manual jump

Source

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

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

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