esolang

The Temporary Stack

Nothing is printed on purpose. A value comes out only when the ones on top of it crush it.

PythonshellDebugwindow, 2019 · Turing complete: unknown · ●●○ moderate · esolangs.org

Tested with 3 known programs · Test method

Run it

Expected: Hello, world!

The idea

PythonshellDebugwindow made The Temporary Stack in 2019. Every value on the stack has a weight, which is the value itself. When the values above the bottom one weigh more than twice the bottom, it is squished. It leaves the stack and is printed as its value minus one. There is no other way to print.

Read the story

And every fifteen commands, comments included, the whole stack is thrown away. That is the temporary in the name.

The machine

Commands are words split by spaces. The first command character in a word decides what it does, so O, Others and cOOde all do the same, and a word with no command still counts.

CommandDoes
v12Push 12, the digits after the v
*textPush the code of each character after the star
@Push the code of each character of a line of input
+Duplicate the top
o OPrint characters, or numbers (the start)
:Repeat the next word until something is pushed or removed
\Repeat the next word until the stack is empty
€Do a random one of these
#Comment

Example

Hello World is written one character up, Ifmmp for Hello.

Hello World is written one character up, Ifmmp for Hello. Each push piles weight on the stack and squishes the oldest characters out in order. v2297 at the end is heavy enough to flush the rest, and the 11 under it comes out as a line feed.

Two ways to print 0. A 3 on a 1 weighs 3, and half of that is 1.5, more than the 1 under it. Three 1s on a 1 weigh 3 as well.

Expected: 0
Expected: 0

: + duplicates the 5 once, since the push stops the repeat. Then 100 squishes both 5s, each printed as 4.

Expected: 44

Patterns it teaches

Further

Stack-based

Write your own in Run Convert a program from The Temporary Stack

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: the-temporary-stack.

Command line

shib run the-temporary-stack -e 'v1 v3'
shib manual the-temporary-stack

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/the-temporary-stack.js

Docs: Kernel instructions · The .shib format · Command line · Adding a language

Source esolangs.org (CC0) · Edit on esolangs.org