esolang

23

A program is a column of blank lines. Their lengths are the numbers in memory, and the numbers are the program.

Philipp Winterberg, 2002 · Turing complete: unknown · ●●○ moderate · esolangs.org

Tested with 4 known programs · Test method

Run it

Expected: Hello World!

The idea

Philipp Winterberg made 23 in 2002. The name is 32 backwards, the code of the space character. In its default notation a program is only spaces and line breaks. Each line's length is one value in memory, read from the bottom line up, and the last line is dropped. 23.ixsy writes the same lines with x, and 23.dezsy lists the values with commas.

Read the story

Memory holds code and data alike, so a program can change itself. Opcode 1 even deletes cells and shifts everything after them back.

The machine

Each value is read modulo 32. A value that is no opcode does nothing.

OpcodeDoes
1 nDelete n cells, starting with the n itself
8 nAdd n to the index
10 n iTake n from cell i
16 c 17 n ...Print c; print the next n values
18 i 19 i nPrint cell i; print n cells from i
20 21 nPrint the cell at the index; print n cells from there
22 v 23 iPrint v or cell i in decimal
27 i jJump to i if cell j is not 0
30 i 31Start one more instruction pointer at i, or at the cell under the index

Every round each instruction pointer takes one step, oldest first. A pointer that meets the value 0 ten times in a row dies, and the program ends when none are left. Values are cut to 255 only when loading.

Example

Opcode 17 prints the next twelve values as characters.

Opcode 17 prints the next twelve values as characters. After them memory is 0, and the pointer dies on its tenth zero.

The same machine with lines of x. The bottom line has 22 of them, so the first value is 22, which prints the value after it, 2, in decimal.

Expected: 2

A test of opcodes 16 to 23 prints each number with its own opcode. Its run of ten zeros kills the pointer before it reaches the data behind them.

Expected: 16 17 18 19 20 21 22 23

The specification also has a 99 bottles of beer that counts down with opcode 10 and jumps back with 27 until the count is 0, then deletes its own text so the pointer runs into zeros.

Patterns it teaches

Further

Concurrent programming

Self-modifying

Write your own in Run Convert a program from 23

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run 23 -e '17,12,72,101,108,108,111,32,87,111,114,108,100,33'
shib manual 23

Source

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

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

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