We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

Jormungandr

From Esolang
Jump to navigation Jump to search

Jormungandr (Jorm) is a Brainfuck derivative where memory is a resizable, cyclic tape.

The main premise of Jorm is that memory is not a fixed linear structure. Commands like ^, X, =, and ? modify the tape by inserting or deleting cells.

Moving the pointer in either direction eventually returns it to the same cells, forming a continuous ring. The ring starts with one cell. Incrementing a cell past 255 wraps to 0, and decrementing a cell past 0 wraps to 255 (modulo 256).

Most commands are inherited from Brainfuck (><+-.,[]), but there are a few that are unique to Jormungandr. Many commands also support numerical suffixes that act as repeat modifiers.

Commands

Command Description
> Move the pointer to the right
>n Move the pointer to the right by n cells
< Move the pointer to the left
<n Move the pointer to the left by n cells
+ Increment the cell at the pointer
+n Increment the cell at the pointer n times
- Decrement the cell at the pointer
-n Decrement the cell at the pointer n times
. Output the character signified by the cell at the pointer
, Input a character and store it in the cell at the pointer
[ Jump past the matching ] if the cell at the pointer is 0
] Jump back to the matching [ if the cell at the pointer is nonzero
^ Insert a new cell, initially containing 0, between the cell at the pointer and the previous cell, then move the pointer to that new cell
^n Insert n new cells, initially containing 0, between the cell at the pointer and the previous cell, then move the pointer to the first new cell
= Insert a new cell, containing the same value as the cell at the pointer, between the cell at the pointer and the previous cell, then move the pointer to that new cell
=n Insert n new cells, each containing the same value as the cell at the pointer, between the cell at the pointer and the previous cell, then move the pointer to the first new cell
X Delete the cell at the pointer, then move the pointer to the cell to the right of the deleted cell
Xn Delete n cells starting at the pointer, then move the pointer to the cell to the right of the deleted cells
Z Set the cell at the pointer to 0
? Compare the cell at the pointer to the following cell and insert the result between the cell at the pointer and the previous cell, then move the pointer to the new cell. The result is 1 if they match and 0 if they do not.

Commands do not move the pointer around the ring unless explicitly stated.

Here is an example of various commands:

ring:  [6, 8, 1, 7]       pointer at 8
^  ->  [6, 0, 8, 1, 7]     pointer at 0
+3 ->  [6, 3, 8, 1, 7]      pointer at 3
?  ->  [6, 0, 3, 8, 1, 7]    pointer at 0
X  ->  [6, 3, 8, 1, 7]        pointer at 3
=2 ->  [6, 3, 3, 3, 8, 1, 7]   pointer at the first 3
<4 ->  [6, 3, 3, 3, 8, 1, 7]    pointer at 8

Using X, Xn, or ? on a ring with only one cell is an error. Unmatched [ and ] commands are also errors.

Examples

Hello, world!

+72.^+101.^+108..^+111.^+44.^+32.^+119.>3.^+114.>2.^+100.^+33.

XKCD Random Number

+52.

Quine

^+93^+53^+62^+46^+91^+62^+93^+51^+60^+46^+60^+46^+60^+93^+51^+62^+88^+93^+50^+60^+48^+49^+45^+60^+43^+51^+62^+45^+91^+63^+60^+43^+50^+60^+45^+91^+51^+62^+48^+49^+43^+50^+61^+53^+43^+46^+49^+53^+45^+46^+52^+57^+43^+94^+62^+61^+91^+50^+60<2[=>^+94.-51.+5=2+10>3[-<2+<?[->3+<-10<2]X>3]<.<.<3]>[.>5]

Trivia

  • Jormungandr was originally named Ouroboros, but that name is taken, so it was renamed to the Norse equivalent.
  • Jörmungandr is an incorrect spelling. The correct letter is o, not ö.

See Also

External Resources