Bolaga
One stack of numbers, a loop that runs while the top is not 0, and a compare that skips.
Fly, 2026 · Turing complete: yes · ●●○ moderate · esolangs.org
Tested with 10 known programs · Test method
Run it
The idea
Fly made Bolaga in 2026. It can add and subtract, but it has no swap and no way to reach below the top of the stack. What it has instead is $, which turns the whole stack round. The specification builds rotation, swap, multiplication and division out of $ and loops, and shows that Bolaga is Turing complete by turning bitwise cyclic tag into it.
The machine
| Command | Does |
|---|---|
>N | Push the number N |
< | Pop |
+ - | Pop a, then b, and push a+b or a-b |
= | Duplicate the top |
$ | Turn the whole stack round |
& | Empty the stack |
@ % | Pop and print a character or a number |
# | Read a line and push the code of each character |
^ | Read a line and push its number |
: ... ; | Loop while the stack is not empty and its top is not 0 |
? | If the top two differ, skip the next command, or the next loop |
! | Stop |
Whitespace is removed first, so a program may break anywhere, even between > and its number.
Example
Hello World pushes its codes in order, so the H is at the bottom.
Hello World pushes its codes in order, so the H is at the bottom. $ brings it to the top, and :@; prints until the stack is empty.
The truth machine pushes 49, the code of 1, and the code of the input. If they are equal, the loop prints 1 forever. If not, ? skips the loop and >0% prints 0.
The counter keeps 11 under the count. Each pass prints the count and a line feed and adds 1, and ? skips the - until the count reaches 11. Then - takes 11 from 11, which leaves 0, and the loop ends.
The 99 bottles of beer program and a calculator are further examples. The calculator multiplies and divides with loops that count down, so its division stops only when it is exact.
Patterns it teaches
- Stack machines: with
$as the only way to the bottom. - Turing completeness: the specification turns bitwise cyclic tag into Bolaga.
Further
See also
Stack-based
Write your own in Run Convert a program from Bolaga
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: bolaga.
Command line
shib run bolaga -e '>49#?:=@;@' --input '0'shib manual bolagaSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/bolaga.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org