An object-oriented programing language that compiles to machine code through Linux NASM x86.
Currently, the compilation only targets x64 Linux. Support for other OS is scheduled sometimes.
The format is similar to TypeScript in many aspects.
- Turing Complete
- Memory Management
- Self-Hosting
Here a brief list of the language current or planned capabilities. As the project is a work in progress, this section and the different syntaxes are subject to change.
Like any modern programing language, V-Script supports declaring scoped variables.
let x = 8; // x is now of type [int];
const y = 'Hello World!'; // y is now of type [str];
The language supports typing.
let my_string: str; // my_string is a [str] (undefined);
const my_bool: bool; // will throw an error;
The main complex data structure is the struct
, it can hold data of different types, and even other struct instances.
struct MyStruct {
field1: str,
field2: int,
field3?: MyStruct // the last field is optional
}
The language also supports functions.
fn my_function(arg1: str, arg2?: bool): int {
// ...
return arg1.length;
}
The default loop in every language.
while condition do {
// ...
}
You already know how it works.
if condition1 do {
// ...
} else if condition2 do {
// ...
} else {
// ...
}
Not yet implemented.
switch val {
1: { /** */ }
2 | 3: { /** */ }
default: { /** */ }
}
Not yet implemented.
label my_label;
//...
goto my_label;
Not yet implemented.
Not yet implemented.
Not yet implemented.
obj Object [ param1: type, param2: type ] <T, Y> ( parent1, parent2, ... ) : {
@properties {
// ...with default values
private name : [type] = value ;
public name : [type] = value ;
static name : [type] = value ;
// ...without default values
private name : [type] ;
public name : [type] ;
}
// default constructor
@constructor default : ( args ) { ... }
// named constructor
@constructor name : ( args ) { ... }
// remark: methods are public by default
@method name ( args ) : [return_type] { ... }
// private method
@method private name ( args ) : [return_type] { ... }
// public method
@method [public] name ( args ) : [return_type] { ... }
// static method
@method static name ( args ) : [return_type] { ... }
// operator overloading
// strict operator overloading
@operator [op, strict] : ( this, other: Object ) { ... }
// loose operator overloading
@operator [op] : ( this, other: any ) { ... }
// loose unary operator overloading (strict means nothing in this context)
@operator [op, unary] : ( this ) { }
}
I am using Arch WSL for the developement, you may need to change the way Linux ASM compiler is ran on your side.
npm start
: Interprets the code using the TypeScript implementation.
-
npm run exec [args]
: Runs the executable without recompiling. -
npm run compile
: Compiles the assembly fileasm/asm.asm
to an executable. -
npm run compile:exec [args]
: Compiles and runs the executable. -
npm run assemble
: Buildssrc/main.vsc
to an executable without running. -
npm run assemble:exec [args]
: Buildssrc/main.vsc
and runs it.
-
npm run test:new
: Creates a new test from the currentsrc/main.vsc
recompilation. -
npm run test <test_name>
: Run a unit test. -
npm run test:all
: Runs all the unit tests insidetests
.
The VSCode extension inside the extension
directory provides syntax hilighting for .vsc
and .test
files.