esolang

Woefully

A program is a wall of pipes. The commands are the cracks of spaces running down through it.

Destructible Watermelon · Turing complete: unknown · ●●● hard · esolangs.org

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

Run it

Expected: 5

The idea

A Woefully program holds only |, spaces and newlines. A space may not touch the start or end of a line. The interpreter finds the first space and follows the spaces below it, down and to the left, straight down, or down and to the right. Which way the path slants picks the kind of command, and how long it is picks the command. There are no conditionals, which is why the specification calls it too much of a tarpit for anyone to have written a prime checker in it.

The machine

PathLength n does
Down-leftPush n - 3 on stack A
Down(n - 3) mod 4: A to B, A minus B, A times B, copy A's top to B
Down-right(n - 3) mod 5: move, nonzero to 1, input, output, swap decimal and text

Both stacks start with one 0. A path of 2 does nothing. When a path ends with a space below it, the next path starts there. Otherwise the run starts again from the char pointer, the top left at first, and move pops a number and moves that pointer through the text. A single space with nothing below it ends the program. Input and output start in decimal: numbers are printed with nothing between them. A program with any other character prints confuse :(. The reference is Woefully.py in github.com/Destructible-Watermelon/Woefully.

Example

The first is a path of 8 spaces down to the left, which pushes 5, then a path of 6 down to the right,…
Expected: 42
Expected: confuse :(

The first is a path of 8 spaces down to the left, which pushes 5, then a path of 6 down to the right, which prints it. The last two rows are a path of 2, and the dead end after it stops the program. The second reads a number with a path of 5 down to the right and prints it the same way.

Patterns it teaches

Further

Stack-based

Write your own in Run Convert a program from Woefully

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run woefully -e '|| |
|| |x'
shib manual woefully

Source

Module
langs/tio/ports.js
Interpreter
langs/tio/woefully.js

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

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