DDR

From Esolang
Jump to: navigation, search

DDR is an esoteric programming language created by User:DoggyDogWhirl. It is inspired by the video game series Dance Dance Revolution, and takes many of its commands from brainfuck.

Commands

DDR code is meant to resemble incoming arrows from Dance Dance Revolution. Each command is made of four arrows (<^v>) and is on its own line. Code must start with "<^v>", or else it is considered a syntax error.

These commands are equivalent to brainfuck commands:

   >  >
<     <
 ^    +
  v   -
 ^v   .
< v   ,
<^    [
  v>  ]

Similarly, a blank line and all characters other than <^v> are considered comments and are ignored.

These are the other commands:

 ^ >  Output the value in the cell at the pointer
<^v   Sets the variable to the value in the cell at the pointer (the variable is set to 0 by default)
 ^v>  Sets the value in the cell at the pointer to the variable
<  >  The next two commands are never run, and instead converted to a number which stored in the cell at the pointer (e.g. " ^ >" and " ^v>" are converted to 01010111, and stored as 87)
<^ >  All commands between this command and its next instance are stored as a function and not run
< v>  Calls the function
<^v>  Halt the program

Example programs

2

Outputs "2".

 ^
 ^
 ^ >

Cat program

<^v>
< v
<^
 ^v
< v
  v>

Hello, world!

<^v>
<  >
 ^
<
 ^v
<  >
 ^v
 ^ >
 ^v
<  >
 ^v
<^
 ^v
 ^v
   >
<  >
 ^v
<^v>
 ^v
   >
<  >
  v
<^
 ^v
<  >
  v

 ^v
<  >
 ^v>
 ^v>
 ^v
<
 ^v
<  >
 ^v>
  v
 ^v
<
 ^v
<  >
 ^v
 ^
 ^v
<  >
  v
   >
 ^v

Implementation

Implementation in Python