esolang

2D-Reversable

Reversable's line of words, stacked into a grid the reader walks in four directions.

Dulph, 2026 · Turing complete: unknown · ●○○ easy · esolangs.org

Tested with 4 known programs · Test method

Run it

Expected: H

The idea

Dulph made 2D-Reversable on 1 April 2026, after Reversable. It keeps every word of Reversable and adds four, UP, DOWN, LEFT and RIGHT, which point the reader. A program is now a grid. Each line is a row and each word in it is a cell, so a Reversable program is a 2D-Reversable program with one row.

Read the story

Dulph built 2D-Reversable 2 on it, where up and down no longer cancel left and right.

The machine

WordDoes
UP DOWN LEFT RIGHTPoint the reader
NOPNothing
SKIPJump over the next word
REVERSETurn around
REVERSE<IA REVERSE<SATurn around if IA is above 0, or if SA is not empty
GET-SA GET-IAAsk for a line, keep its first character or its whole number
OUT-SA OUT-IAPrint it
IA+IB IA-IB IA*IB IA%IBSet IA to the result

The reader starts on the first word of the first line, going right. Words are separated by spaces and tabs are ignored. A line shorter than the longest is filled with NOP. The run ends when the reader would leave the grid. Each GET asks for a line of input, and GET-SA keeps only its first character, as the specification's example says.

Example

The specification's example, with its tabs taken out.

The specification's example, with its tabs taken out. The reader reads a character, turns down at DOWN and right at RIGHT, skips a NOP and turns around at REVERSE. On the way back it skips RIGHT and prints at OUT-SX. Eight words run.

Reversable's cat runs as a grid of one row. Each GET-SA keeps the first character of a line, so it prints the first character of every line and stops at an empty line or the end of the input.

Expected: H

The specification also draws a cat in two dimensions, but it has no OUT-SA. It reads one line and walks off the bottom without printing.

Patterns it teaches

Further

Also in Spatial (2D and up)

Write your own in Run Convert a program from 2D-Reversable

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: 2d-reversable.

Command line

shib run 2d-reversable -e 'SKIP REVERSE GET-SA SKIP OUT-SA REVERSE<SA' --input 'Hello, World!'
shib manual 2d-reversable

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/2d-reversable.js

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

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