esolang

↑110010000100110110010

Six commands, and which of five meanings each one has depends on a pointer that the commands themselves keep moving.

PythonshellDebugwindow, 2020 · Turing complete: yes · ●●● hard · esolangs.org

Tested with 3 known programs · Test method

Run it

Expected: 4

The idea

PythonshellDebugwindow made ↑110010000100110110010 in 2020. It has six commands, ↑ ↓ 0 1 ↕ ↨, and a command pointer that is nil, 0, 1, 2 or anything else. The command pointer picks a column of a table, so ↑ can move the data pointer, add 1 to a cell, add 1 to the jump offset, add 1 to the command pointer, or set the command pointer to 2. The specification says you have to go through the whole program character by character to find out what any one character does.

The machine

There is a tape of integers that runs right from cell 0, a data pointer, a jump offset and the command pointer, which starts as nil.

nil012other
↑data pointer up 1cell up 1jump offset up 1command pointer up 1command pointer to 2
↓data pointer down 1cell down 1jump offset down 1command pointer down 1read an integer into the cell
0data pointer to 0cell to 0jump offset to 0command pointer to 0jump back by the offset
1data pointer to 1cell to 1jump offset to 1command pointer to 1jump forward by the offset
↕command pointer to 0print the data pointer, command pointer to 2print the cellprint the jump offset, then double itprint the command pointer
↨command pointer to 3skip the next command if the cell is not 0command pointer to nilskip the next command if the data pointer is not 0command pointer to nil

A jump counts commands from the jump itself. Numbers print in decimal with nothing between them. The specification leaves a data pointer below 0 and a jump out of the program undefined; this implementation stops the run in both cases.

Example

The XKCD random number moves the data pointer to 4, sets the command pointer to 0 and prints the data pointer.

The XKCD random number moves the data pointer to 4, sets the command pointer to 0 and prints the data pointer.

The one-time cat sets the command pointer to 3, where ↓ reads an integer, then walks it down to 1, where ↕ prints the cell.

Expected: 42

The specification proves it Turing complete by translating brainfuck. Its + is ↑0↑↕↑, which prints the data pointer on the way, as only the tape matters for the proof. So the brainfuck program +. prints 0 for the + and then 1 for the ..

Expected: 01

The specification's own [-] example sets the forward jump of its loop to 49. A jump that counts from itself, which the backward jump of 95 needs, then lands 6 commands short of the end of the loop; 55 lands right after it.

Patterns it teaches

Further

Cell-based

Write your own in Run Convert a program from ↑110010000100110110010

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run 110010000100110110010 -e '↨↓↑↓↕' --input '42'
shib manual 110010000100110110010

Source

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

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

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