V3i

From Esolang
Jump to navigation Jump to search

V3i, an abbreviation for Variable 3 Input, is an esoteric programming language created by BowlingPizzaBall which has only three variables named x, y, and z.
Despite this, the language is somewhat powerful, having stuff like a wait function and the support for infinite loops.

Functions

Function Definition Arguments/Examples
def Defines one of the 3 variables. def <x,y, or z> <varcontent>
var Calls one of the 3 variables. var <x,y, or z>
+ Adds 2 numbers. n+n
- Subtracts 2 numbers. n-n
* Gives the product of 2 numbers. n*n
/ Gives the quotient of 2 numbers. /
sqrt Gives the square root of a number. sqrt n
% Gives the mod of 2 numbers. n%n
= Checks if something is equal to something. Returns 1 if so, 0 if not. 6=4 (returns 0)
> Checks if a number is greater than another. Returns 1 if so, 0 if not. 6>4 (returns 1)
< Checks if a number is less than another. Returns 1 if so, 0 if not. 6<4 (returns 0)
print Prints something. print <"text"/number/variable>
if If statement. if <content> <condition> <content>
else Else statement. else <content>
loop Starts a loop. loop <timesToLoop> <contentToLoop>
iloop Starts an infinite loop. iloop <content to loop>
input Halts execution until an input is received from the user. None
wait Waits for n milliseconds. wait <ms>
# Comment function. # <comment> #
end Ends execution. (optional) None

Examples

Hello World

print "Hello, World!";

Truth Machine

if input = 0;
print "0"; end;
else;
iloop print "1";

Cat

print input;

Fibonacci

def x 1;
def y 1;
print 0;
print 1;
print 1;
iloop def x x+y print x def y y+x print y;

99 bottles of beer

def x 99;
loop 99;
if x = 1;
print "1 bottle of beer on the wall"
print "1 bottle of beer"
print "Take one down, pass it around"
print "No more bottles of beer on the wall"
else;
print x " bottles of beer on the wall";
print x " bottles of beer";
print "Take one down, pass it around";
def x x-1;
print x " bottles of beer on the wall";

Deadfish

def x 0;
iloop if input = o;
print x;
else if input = i;
def x x+1;
else if input = d;
def x x-1;
else if input = s;
def x x*x;
else; print "Invalid command";

Computational class

Language is Turing complete by reduction from Infinite GotoStart with 3 registers.
Program starts with:

iloop;

+(x) becomes:

def x x+1;

-(x) becomes:

def x x-1;

=(x:y) becomes:

def x y;

?(x=y>abc)xyz becomes:

if x=y;
abc;
xyz;
else;
xyz;

Interpreter

It will come soon, or at least when I fully understand python and its sys module.