esolang

Minicode

A command, a variable, a value. Loops are a jump back to a line number.

Kirill Leonov, 2024 · Turing complete: yes · ●○○ easy · esolangs.org

Tested with 3 known programs · Test method

Run it

Expected: Hello world Hello world Hello world Hello world Hello world

The idea

Kirill Leonov wrote Minicode in January 2024, with an interpreter in Rust. Each line starts with a short command and a variable name. There are no quotes; a value is a number when it reads as one, a variable when one has that name, and plain text otherwise. There is no loop and no if. The ? command compares two values and jumps to a line number when the comparison holds, so a jump back is a loop and a jump ahead is a branch.

The machine

LineDoes
> a valueAssign a number, a copy of a variable, or text
> b a iAssign character i of the string in a
p aPrint the value and a line break
= a + bChange a number by + - * or /
? a ! b 4Go to line 4 if a differs from b; also = > <
$> aSet a to a line of input, asked before the run

Lines count from 1, and a comparison needs two values of one type. The full language also reads and writes files, runs system commands and includes other files. This implementation leaves those five commands out, and the prompt text that $> can show.

Example

The loop counts a up to 5 and jumps back to line 3 until it gets there.

The loop counts a up to 5 and jumps back to line 3 until it gets there.

The "hello" program, line by line. Past the end of the string the character is empty, which is printed as an empty line and ends the loop.

Expected: h e l l o

Two branches jump over the lines between them, so only the last line prints.

Expected: just text

Patterns it teaches

Further

Also in Turing tarpits

Write your own in Run Convert a program from Minicode

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run minicode -e '> a 0
> b Hello world
= a + 1
p b
? a ! 5 3'
shib manual minicode

Source

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

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

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