The Temporary Stack

From Esolang
Jump to navigation Jump to search

The Temporary Stack is an stack-based esoteric coding language created by User:PythonshellDebugwindow.


Instructions are separated by spaces.

Instruction Meaning
@ Pushes to the stack the ASCII value of the each character of user input.
v Pushes to the stack the base-10 integer value of the number following this "v" (no space between this "v" and that number)
* Pushes to the stack the ASCII value of each character following this "*" (no space between this "*" and those character(s), and spaces can't be used - use "v" instead)
O Switches the output mode from ASCII value to base-10 integer value (the default)
o Inverse of "O"
+ Duplicates the top of the stack; the duplicate is added to the stack
: Repeats the next instruction until a value is either pushed to or removed from the stack (the next instruction still only counts as one command - see the bottom of the next section)
\ Repeats the next instruction until the stack is empty (the next instruction still only counts as one command - see the bottom of the next section)
Performs a random action (other than comment)
# Comment until space, which is command/comment separator

"v" and "*" are just different ways of achieving the same thing, but "*" is better for multiple chars and only "v" can be used for spaces.

All other characters are treated as comments, but if you want to write them, leave out the letters "O", "o", and "v", but they count as commands too (see the bottom of the next section). If you want to have a smaller command count, then you can use something like dashes or underscores instead of spaces.

The stack

The Temporary Stack has one way to store values (which must be integers): the stack. Each value has a "weight", which is just its value. Infinite values can be stored, but there is a catch: if the sum of all values' weights on the stack except for that of the bottom one, divided by two, is greater than the weight of the bottom value, then the bottom one gets "squished" and either the ASCII character of its value minus one, or just its value minus one, is output, depending on the output mode, which defaults to base-10 value and can be switched with "O" and "o". For example,

v1 v3

would output 0, and so would

v1 v1 v1 v1

because in both examples, the combined weights of all values in the stack except for the bottom one was 3, and that of the bottom value was 1, and since 3 divided by 2 is 1.5, which is greater than 1, the bottom value in the stack (1) was decremented by 1, removed from the stack, and output as a base-10 integer.

And as if that isn't hard enough, every fifteen commands, including comments, the stack is reset, hence the name "The Temporary Stack".


Hello, World!

o *Ifmmp-!Xpsme" v2285

This works because the sum of the ASCII values of all characters in 'Ifmmp-!Xpsme"' is 1142, times two is 2284, plus one is 2285, and all the characters in 'Ifmmp-!Xpsme"' are "squished", decremented by one, and output, resulting in 'Hello, World!'.


o @ \ v100