DBFV!

From Esolang
Jump to: navigation, search

DBFV! is an esoteric programming language by David Catt (User:David.werecat) where each line of code is a separate function.

Instructions

Instruction Description
x:[] Defines a loop for x not zero
x:() Defines a loop for x is zero
x<n Sets x to equal n
x> Outputs the ascii value of x
!n Jumps to function n
~n Calls function n
^ Returns from a call
x+ Increments x
x- Decrements x
>x Reads a value and stores in x
x% Skips the next instruction if x not zero
x& Skips the next instruction if x is zero
+n Skips n characters ahead in the line
x|n Swaps the values in x and n
.x Sets x to zero
*xn Adds n to x
$n Ends the program and returns n
n/ Pushes n into stack 1
/x Pops stack 1 and puts in x
n\ Pushes n into stack 2
\x Pops stack 2 and puts in x
@text@ Defines a comment

In the examples, x and n are registers. Registers are defined as A-Z (uppercase) and store a single wrapping byte of data. n can also be an immediate constant, which is a number from 0-9. Whenever the instruction to be skipped is a loop, the entire loop is skipped.

Computational class

The following translation rules from Brainfuck show that DBFV! is Turing-complete.

brainfuck DBFV!
begin 0\.X
> X/\E+E0\0\\X
< X\4\/X
+ X+
- X-
. X>
, >X
[ X:[
] ]
end $0

External resources