Syntax - MattiDragon/VCCL GitHub Wiki
The syntax of VCCL is quite simple: Every command starts with a variable name the a colon and an expression. Here is an example of a simple command:
foo: bar + baz
You'll most likely need a flew constants in your code. Those are produced by typing #
and a constant instead of a variable name. Constants can be numbers, strings (both single and double ticks), or booleans (lower case). IO is done by using variables; using string_in
you can read a line of input from the user and using string-out
you can print any string. If you need more precise controll you can use unicode_in
and unicode_out
to read in the unicode values of characters. Here is a simple program that print the same as you input:
string_out: string_in
These are all the possible expressions as of version 0.1:
-
<bool> ? <any> : <any>
Returns the first value if the boolean is true otherwise it returns the second value. -
<any>
Returns the value of the parameter. This can be used to initialize variable with constants or copying. -
<any> + <any>
If both are numbers this adds them up. If one of the is a string then they are merged. -
<num|str> * <num|str>
If one if a string it's repeated the number of times the other value specifies. Otherwise multiplies the numbers. -
<num> - <num>
Subtracts the second one from the first one. -
<num> / <num>
Divides the first one by the second one. -
<bool> | <bool>
Preforms a logical OR operation on the two booleans. -
<bool> & <bool>
Preforms a logical AND operation on the two booleans. -
! <bool>
Preforms a logical NOT operation on the boolean. -
<any> = <any>
Compares if both are the same thing. Types matter. -
<num> < <num>
Checks if the first one is less than the second one -
<num> > <num>
Checks if the first one is greater than the second one
Flow control is mostly done by writing to the pointer
variable using if expressions. Here is an example that prints "Hello" three times:
i: #0
string_out: #"Hello\n"
should_break: i = #2
i: i + #1
pointer: should_break ? #-1 : #2
The program will stop as soon as the pointer goes out of bounds.