esolang

Jumper

Seven commands, a RAM of bytes and goto. The output is whatever is left in memory.

Somnium, 2014 · Turing complete: yes · ●○○ easy · esolangs.org

Tested with 4 known programs · Test method

Run it

Expected: Hello world!

The idea

Somnium made Jumper in 2014 for a code golf challenge, where the task was to write its interpreter in as few characters as possible. It is close to brainfuck, but the only way to steer is a jump to a command by its number. A ? in front of a command runs it only when the current cell is not 0, so ?:17 is the conditional jump.

Read the story

There is no print and no read. The input is written into memory before the run, and after the run the memory from cell 0 up to the first zero byte is the output.

The machine

CommandDoes
#nSet the pointer to cell n
>n <nMove the pointer n cells right or left
=nWrite n into the cell
+n -nAdd or take away n, modulo 256
:nGo to command n, counting from 0
?Run the next command only if the cell is not 0
(text)A comment

Without a number > < + - take 1 and # = : take 0. The RAM grows as far as it is written. A brainfuck loop becomes two jumps, so Jumper can compute whatever brainfuck can.

Example

The first program writes twelve characters and a 0 after them, so it prints Hello world! whatever the…
Expected: Hello world!

The first program writes twelve characters and a 0 after them, so it prints Hello world! whatever the input is. The second walks right along the input until it finds a 0, writes ! there and a 0 after it. Its seven commands are numbered 0 to 6, and command 0 jumps to command 2 as long as the cell is not 0.

Expected: Hi

Patterns it teaches

Further

Golfing languages

Write your own in Run Convert a program from Jumper

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run jumper -e '(appends "!" to the end of input string)
?:2 :4 >1 :0 =33 >1 =0' --input 'Hello world'
shib manual jumper

Source

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

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

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