Hanoi

From Esolang
Jump to navigation Jump to search
Hanoi
Paradigm(s) stack-driven
Designed by Otesunki (talk)
Appeared in 2022
Memory system stack-based
Computational class Total
Reference implementation hanoi.js
Influenced by Reversible Brainfuck
File extension(s)

Hanoi is a stack-based esoteric programming language designed by Otesunki (talk), composed of three towers (or four if you count the I/O tower), where each element in each tower must be less than or equal to the element below it.

Instruction Description
- Subtraction: Pop the two most recent values off the current stack as a and b. push b, then push b - a.
> Duplicate: Pop a value off stack 2, then push it back twice.
< Deduplicate: Pop two values off stack 2, if they're equal, push the value back once. otherwise, error.
( 1->2: Pop a value off stack 1, then try to push the value to stack 2.
) 2->1: Pop a value off stack 2, then try to push the value to stack 1.
[ 3->2: Pop a value off stack 3, then try to push the value to stack 2.
] 2->3: Pop a value off stack 2, then try to push the value to stack 3.
{ i->2: Get a character from stdin, then try to push it's ASCII code to stack 2.
} 2->o: Pop a value off stack 2, then output it's value as ASCII.

Examples

Single character cat:

   {}