Your stack may be eaten

From Esolang
Jump to navigation Jump to search

Your stack may be eaten is an esolang by User:BoundedBeans, developed entirely on the wiki in an hour. The stack has the potential to be eaten into the code, so watch out.

Execution

Run the commands from first to last. After every command, “eat” a character from the stack and put it on the end of the code. The stack being eaten is the only way to do loops or conditionals.

Storage

It only has a stack, though there is a stack pointer for arbitrary access. Conceivably the code is also storage, but it is very difficult to “access” the data, since it will only be executed.

Syntax

All characters until the exclamation point are the code. After the exclamation point is the contents of the stack, with the first character being the top. On both parts, any non-command characters are ignored. This means the stack may only have valid commands. It also means the input and output can only work with the characters v^$:/{}_@[, meaning you'll likely have to encode it in some way and have the user decode it manually.

Instructions

Note: There is no way to create stack elements of a character that does not already exist in it, so all characters you want on the stack should be in the initial stack state in the syntax.

v - take the currently pointed cell, push it to the stack
^ - delete the currently pointed cell
$ - pop
: - take the currently pointed cell, make a copy and put it below
/ - swap the currently pointed cell with the one below it
{ - move the stack pointer up
} - move the stack pointer down
If either of the curly brackets would go outside of the stack, do nothing
_ - input a character and insert it below the stack pointer. If not a valid instruction, insert ^
@ - output the currently pointed character, removing it
[ - push the contents of the entire stack to the stack

Examples

Print out infinite v’s

[v@![v@

Implementation

There is an implementation on the talk page.