2D-Reversable 2
2D-Reversable 2 is an esoteric programming language created by User:Dulph on April 1st, 2026. It is inspired by 2D-Reversable, with the main difference being in the way directions are handled. As such, all Reversable programs can be run in 2D-Reversable 2.
Syntax
Programs can be single lined or multilined. A single-line program that only uses Reversable commands can be compiled into reversable. When running, a program will run as Reversable until it reaches a 2D-Reversable 2 command. The program read direction always starts at LEFT.
Unlike 2D-Reversable, 2D-Reversable 2 has 2 read directions : vertical and horizontal. Each direction can have 3 values : -1, 0 and 1.
Vertically :
- -1 : Next instruction will be read up from the current one
- 0 : Next instruction will be read on the same line as the current one
- 1 : Next instruction will be read down from the current one
Horizontally :
- -1 : Next instruction will be read left from the current one
- 0 : Next instruction will be read on the same colmun as the current one
- 1 : Next instruction will be read right from the current one
Example :
GET-SX DOWN NOP OUT-SX NOP REVERSE
This program runs as such :
- Start of the program (directions : middle-right)
- GET-SX : Asks the user to input a string and stores the first caracter into variable SX
- DOWN : Changes the vertical read direction to DOWN (directions : down-right).
- REVERSE : Reverses both directions (directions : up-left)
- DOWN : Changes the vertical read direction to DOWN (directions down-left)
- OUT-SX : Outputs the content of SX
Commands
Program ends itself upon attempting to reach an out of bound instruction or if both directions are equal to 0. Commands are separated with a single space. During execution, any tabs are ignored
| Instruction | Desc |
|---|---|
| NOP | Does nothing |
| SKIP | Skips next instruction |
| REVERSE | Reverses both of the read directions |
| REVERSE<IA | Reverses the read direction if IA > 0 (IA being of type integer) |
| REVERSE<SA | Reverses the read direction if SA is not an empty string (SA being of type empty string) |
| GET-PX | Asks for input and stores it in var PX as P type |
| OUT-PX | Prints the value of var PX |
| IA+IB | Sets IA to IA + IB |
| IA-IB | Sets IA to IA - IB |
| IA*IB | Sets IA to IA * IB |
| IA%IB | Sets IA to the remainder of IA divided by IB |
| UP | Changes the vertical read direction to up (-1) |
| DOWN | Changes the vertical read direction to down (1) |
| LEFT | Changes the horizontal read direction to left (-1) |
| RIGHT | Changes the horizontal read direction to right (1) |
| MIDDLE-V | Sets the vertical direction to 0 |
| MIDDLE-H | Sets the horizontal direction to 0 |
Variable types
Only 2 variable types are supported by 2D-Reversable :
- Integers, named with prefix I
- Caracters, named with prefix S
Examples
Cat
Cat in default Reversable (that can be ran in 2D-Reversable 2) :
SKIP REVERSE GET-SA SKIP OUT-SA REVERSE<SA
Cat in 2D-Reversable 2 : TODO
Implementations
- Python Implementation : Original implementation by User:Dulph