Jormungandr
Brainfuck on a ring of cells that the program can grow and cut.
2026 · Turing complete: yes · ●●○ moderate · esolangs.org
Tested with 3 known programs · Test method
Run it
The idea
Jormungandr is a brainfuck from 2026 whose memory is a ring rather than a tape. The ring starts as one cell, and moving past either end comes round to the other. Four commands change the ring itself. ^ and = put new cells in before the pointer, X cuts cells out, and ? puts in the result of a comparison. Most commands take a count, so +72 adds 72 and >3 moves three cells.
Read the story
The specification says the language was first called Ouroboros, a name already taken, and was renamed after the Norse serpent that bites its own tail. Its nearest relative is Circlefuck.
The machine
| Command | Does |
|---|---|
> < + - . , [ ] | As in brainfuck |
>n <n +n -n | The same n times |
^ ^n | Put 1 or n cells holding 0 before the pointer and move to the first |
= =n | The same with copies of the current cell |
X Xn | Cut 1 or n cells from the pointer rightwards and move to the cell after them |
Z | Set the cell to 0 |
? | Put 1 before the pointer if the current cell equals the next, else 0, and move to it |
Cells hold 0 to 255 and wrap. X and ? on a ring of one cell are errors, and so are unmatched brackets.
Example
Each ^ puts a fresh cell before the last letter, so the letters pile up to the left.
Each ^ puts a fresh cell before the last letter, so the letters pile up to the left. >3 goes back to the o of Hello for world, and >2 to its l.
The second line is the XKCD random number. The quine stores its second half as one ^+n per character. The second half then prints each stored number back as ^+n and after that the stored characters themselves.
Patterns it teaches
- Turing tarpit: brainfuck's eight commands on memory that can grow.
- Quine: data that is printed twice, once as code and once as text.
Further
See also
Jormungandr builds on Brainfuck.
Brainfuck derivatives
Cell-based
Write your own in Run Convert a program from Jormungandr
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: jormungandr.
Command line
shib run jormungandr -e '+52.'shib manual jormungandrSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/jormungandr.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org