Bauberqueue
A queue for every integer, and the program is what the first few queues hold at the start.
Quintopia, 2017 · Turing complete: yes · ●●● hard · esolangs.org
Tested with 5 known programs · Test method
Run it
The idea
Quintopia made Bauberqueue in 2017 from two older languages. From Aubergine it takes three-character commands and registers that point into memory. From Resplicate it takes copying as the only way to branch. Memory is a queue for every integer, and line n of the program is loaded into queue n.
Read the story
Code runs from the queue that register i names, three characters at a time. So the program eats itself as it runs. A loop is a command that copies the next stretch of code to the back of its own queue twice: one copy runs now, the other is there for the next round. When the count it copies is wrong, the code runs out and the program stops.
The machine
Registers a and b start at 0, i at 1. A, B and I are the queues those registers name; reading one pops it, writing one pushes to it. 1 is the number 1, and o is input as a source and output as a target. Popping an empty queue gives 0.
| Command | Does |
|---|---|
=ts | t becomes s |
+ts -ts | t becomes t+s or t-s |
xyz | Pop z values from queue y and push them to queue x twice |
| anything else | Ends the program |
Example
The plainest Hello World.
The plainest Hello World. Register a becomes 2, and each =oA prints one character of line 2. Then queue 1 is empty, it pops three zeros, and that is not a command.
The truth machine. It reads a digit, subtracts the . it pops from its own line, and jumps to line 2 or line 3. Line 3 copies its own 8 characters to the back twice each time round, so it prints 1 forever.
The specification also has a bootstrap quine. It prints a program whose escaped form is the program itself, and that printed program prints itself again.
Further
Ideas it shows
See also
Queue-based
Self-modifying
Write your own in Run Convert a program from Bauberqueue
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: bauberqueue.
Command line
shib run bauberqueue -e '=ao-aI.=ia
=oI0
iiI\x08=oI1iiI\x08' --input '0'shib manual bauberqueueSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/bauberqueue.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org