esolang

Shove

A 2D language that never overwrites code. It shoves strings in, and the rest of the row slides out of the way.

ais523, 2008 · Turing complete: unknown · ●●● hard · esolangs.org

Tested with 2 known programs · Hello World on Try It Online: identical · Test method

Run it

Expected: Hello, World!

The idea

ais523 made Shove in 2008 and forgot to tell anyone until 2013. It is a two-dimensional language, like Befunge, with a stack of strings instead of numbers.

Read the story

Strings come off the playfield between quotes. The odd part is how they go back. Popping a string does not write over cells. It inserts the string, and the whole ray of cells from that point on is pushed along to make room. If the instruction pointer sits on that ray, it gets pushed too.

So the program grows as it runs. A loop can lengthen itself each time round, which is how the counter prints one more star per line.

The machine

A playfield of characters and a stack of strings. The pointer starts top left, moving right. The program halts when the pointer leaves the playfield.

CharDoes
' "Push the text up to the matching quote; the other kind of quote nests inside
< v > ^Turn
A V ( )Pop a string and shove it in, starting at the cell above, below, left or right, laid out in the current direction
SPrint the top string without popping
nPrint a newline
space !Do nothing

Popping an empty stack shoves an empty string, which changes nothing.

Example

The first row pushes ,olleH and V shoves it into the row below, just under itself.

The first row pushes ,olleH and V shoves it into the row below, just under itself. The rest of that row, "<, slides seven cells right, so < lands exactly under the v. The pointer turns down, then left, and reads the second row backwards as one string: Hello, World!. S prints it and the pointer walks off the left edge.

Patterns it teaches

Try this

  1. Print hi and a newline in one row.
  2. Change the example so it greets Everyone instead of World. Which row must change?
  3. Hard: trace the counter, >"*"V" ")v over ^nS"" <, for two rounds.

Further

Self-modifying

Two-dimensional languages

Write your own in Run Convert a program from Shove

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: shove.

Command line

shib run shove -e ''\''say "hi"'\''Sn'
shib manual shove

Source

Module
langs/stack/ports.js
Interpreter
langs/stack/shove.js

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

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