Nondescript
Every command is a number, one a line. The specification calls it riveting.
PixelatedStarfish, 2021 · Turing complete: yes · ●○○ easy · esolangs.org
Tested with 3 known programs · Test method
Run it
The idea
PixelatedStarfish made Nondescript in 2021 as a plain base for another language, Bedtime, which compiles to it. It was made to have a simple interpreter. A program is one command a line, each a number from 0 to 13, sometimes with one argument after it. The stack holds bytes from 0 to 255, and adding 1 to 255 gives 0.
The machine
| Command | Does |
|---|---|
0 2 | Print the top as a number or as a character |
1 n | Print the character n |
3 10 | Pop; duplicate the top |
4 n | Push n, or 0 |
5 n | Add n to the top, or 1 |
6 L | A label |
7 L 8 L | Jump to the label, always or when the top is 0; to the start without one |
9 | Read a character; 9 1 reads a number and 9 2 a line |
11 | Shuffle the stack |
12 13 | Halt; do nothing |
-1 and # start a comment. An argument that is no number stands for its first character, so 1 H prints H just as 1 72 does. The specification does not say whether printing adds a line feed; nothing does.
Example
The Hello World prints each letter by its code.
The Hello World prints each letter by its code.
The truth machine takes 48 off the character it reads. On 0 it jumps to label 0 and prints 0 once; on 1 it prints 1 forever between label 1 and 7 1.
A countdown. 8 2 leaves the loop once the top is 0.
The random number pushes 1 to 10, shuffles and prints the top. The shuffle starts from the same seed every run, so a run replays, and it prints 1.
Patterns it teaches
- Stack machines: fourteen numbered commands on one stack of bytes.
Further
See also
Stack-based
Write your own in Run Convert a program from Nondescript
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: nondescript.
Command line
shib run nondescript -e '1 H
1 E
1 L
1 L
1 O
1 32
1 W
1 O
1 R
1 L
1 D'shib manual nondescriptSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/nondescript.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org