DJ Qarkegs - Above The Sky
One stack of bytes and six digits. Brainfuck still fits, once the stack is bent into a ring.
Hakerh400, 2020 · Turing complete: yes · ●●○ moderate · esolangs.org
Tested with 2 known programs · Test method
Run it
The idea
Hakerh400 made DJ Qarkegs - Above The Sky in 2020. It has a single stack of bytes and no other place to keep anything. The commands are the digits 0 to 5 and a loop in brackets. There is no way to write a number, so every byte is counted up one at a time.
Read the story
The specification shows it is Turing complete by turning brainfuck into it. The stack becomes a ring of cells with the current cell on top. Moving to the next cell takes the top byte to the bottom of the stack. 5 reverses the stack to reach the bottom, and a loop carries the byte over one unit at a time.
The machine
| Command | Does |
|---|---|
0 | Push the next input byte, or 0 after the end |
1 | Pop a byte and print it |
2 | Pop a byte |
3 | Duplicate the top |
4 | Add 1 to the top; 255 becomes 0 |
5 | Reverse the stack |
(...) | Repeat while the top is not 0 |
Whitespace is ignored and any other character is an error. Popping or reading the top of an empty stack stops the run with an error.
The conversion from brainfuck, with * standing for 255 4s, which subtract 1.
| Brainfuck | DJ Qarkegs |
|---|---|
+ - | 4 * |
, . | 0 31 |
[ ] | ( ) |
> | 53(4)5(*545)2 |
< | 3(4)5(*545)25 |
3(4) pushes a 0 whatever the top holds, as (4) counts the copy up until it wraps. The converted program starts with 0(4) and one 3 for each further cell, which lays out a ring of zeros.
Example
The cat reads a byte and, while it is not 0, prints it and reads the next.
The cat reads a byte and, while it is not 0, prints it and reads the next. After the end of the input it reads 0 and stops.
Thirty three 4s make an exclamation mark.
3(4) pushes a 0 on top of the b, and 5 turns the stack over to bring the b back up.
The Hello, World! is its conversion of a 72 character brainfuck program onto a ring of 10 cells. It is 12,079 characters long and runs over 110 million commands. It prints Hello, World!.
Patterns it teaches
- Turing tarpit: six digits and one loop.
- Turing completeness: shown by compiling brainfuck into it, on a ring with a fixed number of cells.
- Stack machines: one stack, reversed to reach its far end.
See also
Stack-based
Write your own in Run Convert a program from DJ Qarkegs - Above The Sky
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: dj-qarkegs-above-the-sky.
Command line
shib run dj-qarkegs-above-the-sky -e '0(10)' --input 'cat'shib manual dj-qarkegs-above-the-skySource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/dj-qarkegs-above-the-sky.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org