Minimal-2D

From Esolang
Jump to navigation Jump to search

Minimal-2D is the name of a 2D programming language made by User:Alegend, on August 10, 2009. It only has 11 commands:

Cmd Description
< Move the data pointer left.
> Move the data pointer right.
+ Add to the value in the data pointer.
- Subtract from the value in the data pointer.
. Outputs the value in the data pointer.
, Asks for input from the user.
/ Skips next instruction if the data pointer is set to 0.
U Tells the program to switch to the up direction of processing instructions.
D Tells the program to switch to the down direction of processing instructions.
L Tells the program to switch to the left direction of processing instructions.
R Tells the program to switch to the right direction of processing instructions.

The program, when it starts, automatically starts processing in the rightward direction.

Example

Hello World

>++  R<+++D R >++++++>+++++++++>++++++++++D
D++>R/ </ +/U/-<<<<<<+++++++++++>+++>++++>L
+   UU/->+LD    .++++++++++>.--------.----L
R+++.>++.>--..+++.>.>-.>--.--------.+++.--U

Computational class

Minimal-2D is obviously Turing-complete through reduction from Brainfuck, as a Brainfuck loop

abcd[efgh]ijkl

can be translated as:

abcd/D    /LRijkl
     Refgh/UU

External resources

  • An interpreter can be found here.
  • An interpreter written in c++ with additional (but optional) language features can be found here.