VD3 is a simple programing language. It has only one command.
Syntax and commands
VD3 syntax is simply:
X, Y and Z can be variables or signed, unbound integers. Variables are as follows:
The following example shows how VD3 expressions work:
W is now X+Y+Z. In VD3 2.0 it can be too:
... means every empty command position after it (and before next ...) has same command.
A is now 2 (1+1+0).
Now A is 6 (1+2+3) and B is 7 (A+1+0).
This program prints the ASCII character 65 (A).
This program stores an ascii character from input in variable A.
PC<-2^0^0 OUT<-65^0^0 OUT<-66^0^0
This program prints only B. It skips the command in position 1 (OUT<-65^0^0). Command position numbering starts from 0.
This program halts and doesn't print A because jumping to negative positions stops the program.
Jump if zero(VD3 2.0 only)
E<-5^0^0 F<-PC^2^0 PC<-7^IN^-48 OUT<-66^0^0 PC<-0^0^-1 OUT<-65^0^0 PC<-0^0^-1 PC<-E^0^0 ...PC<-F^0^0
This program ask input. If ascii code of input is 48('0') then jump to 7 and from 7 to 5(saved to E) and print A, if ascii code is greater than 48 jump to >7 and then jump to 3(saved to F) and print B.
VD3 2.0 is Turing-complete. To show this, we will implement any 2-counter machine with instructions INC, DEC, and JZ. Let X be the position of the current command, and let L be the total number of commands excluding the postfix. Let
B, and let
Z denote a jump destination position. Then, each instruction can be implemented:
C<-X^0^0 PC<-R^(L+1)^0 PC<-Z^0^0
PC<--1^0^0 PC<-C^2^0 ...PC<-C^3^0
The computational class of VD3 without VD3 2.0 features is unknown.