Minim
No variables, no loops, no if. One tape of 65,536 numbers, C's operators, Python's slices and goto.
Christian Alexander, 2017 · Turing complete: unknown · ●●○ moderate · esolangs.org
Tested with 4 known programs · Test method
Run it
The idea
Christian Alexander, KakkoiiChris on the wiki, made Minim in 2017 as the final project of a college Java class, and kept changing it until a fifth version in Kotlin. The aim was just enough features to stay a reasonable challenge. There are no names. Every value lives on one tape, read as [42] for one place or [2 : 9 : 2] for a slice, as in Python. Text is an array of codes that ends in a 0, so printing a string is a loop that walks the tape until it reads that 0.
Read the story
Control is labels and jumps. _> 1. marks a place, _< 1. goes there, and _^ c. skips the next statement when c holds. An if, a while and a for are patterns built from these, and the specification lists them.
The machine
| Statement | Does |
|---|---|
expr. | Evaluate, usually an assignment like [0] = 1. |
#> [i]. #< e. | Read or write a number; add i for an integer |
$> [i]. $< e. | Read or write a character |
_> n. _< n. | A label, and go to it |
_^ c. | Skip the next statement if c is not 0 |
_+ n. _-. | Call a label, and return |
M+. M-. | Push or pop a clean memory |
Every statement ends in a period, and ; starts a comment. Values are 32-bit floats unless the cast i makes them integers. The system calls \< \> \!, and the library of maths and text functions they reach, are not implemented.
Example
Hello world.
Hello world. [0] holds a pointer, [[0]++] reads where it points and moves it, and the loop goes on while the place it reaches is not 0.
Two examples of a jump. With a true condition the A is skipped.
The truth machine. A number read with #> is a float, and #< writes one as 0.0.
The specification's examples do not agree on how numbers print. Its rules say every value is a float and #< writes floats, while a few of its comments show whole numbers. This implementation follows the rules, so the FizzBuzz program prints 1.0 2.0 Fizz and the 99 bottles start at 99.0.
Patterns it teaches
- Encoding tricks: strings end in a 0 that the print loop tests for.
Further
See also
Also in Turing tarpits
Write your own in Run Convert a program from Minim
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: minim.
Command line
shib run minim -e '_^ 1.
$< '\''A'\''.
$< '\''B'\''.'shib manual minimSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/minim.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org