Vox is a multiparadigm programming language inspired by D (60%), Jai (30%), and Zig (10%).
Supported:
Planned:
i32 fib(i32 number) {
if (number < 1) return 0;
if (number < 3) return 1;
return fib(number-1) + fib(number-2);
}
struct Point {
i32 x;
i32 y;
}
T min[T](T a, T b) {
if (a < b) return a;
return b;
}
Example of JIT compilation for amd64 from D code:
In main.d
uncomment one of the following lines:
//version = bench; // Runs benchmark
//version = devtest; // Run single test with fine-tuned logging. Useful for development. Uses tester.runDevTests(). Toggle options there for precise analisys while developing.
//version = test; // Runs test suite. Uses tester.runAllTests().
and run with: source> dmd -m64 -i main.d && main
Benchmarking:
ldc2 -d-version=bench -m64 -O3 -release -boundscheck=off -enable-inlining -flto=full -i main.d && main
Debug CLI build:
dmd -i -g -m64 -version=cli main.d -of=vox.exe
Release CLI build:
ldc2 -d-version=cli -m64 -O3 -release -boundscheck=off -enable-inlining -flto=full -mcpu=native -i main.d -of=vox.exe
Debug shared library build:
ldc2 -m64 -shared -g -d-debug -fvisibility=hidden -link-defaultlib-shared=false -i c_api.d -of=libvox.dll
Compiling with Profile Guided Optimization:
ldc2 -d-version=test -m64 -release -fprofile-instr-generate -mcpu=native -i main.d -of=vox_instrumented.exe
vox_instrumented
ldc-profdata merge default.profraw -output vox.profdata
ldc2 -d-version=cli -m64 -O3 -release -boundscheck=off -enable-inlining -flto=full -mcpu=native -fprofile-instr-use=vox.profdata -i main.d -of=vox.exe
Gives the full list of flags
vox --help
.vx
files are source code files..har
files, aka Human Readable Archive files. A text file that combines multiple textual files.Each file must begin with --- <path>
, three dashes, space, and name.
Files can be nested inside directories --- dir/dir2/file.txt
.
Example:
--- main.vx
import kernel32;
void main() { ExitProcess(42); }
--- kernel32.vx
@extern(module, "kernel32")
noreturn ExitProcess(u32 uExitCode);
Can be compiled with vox program.har
The compiler contains embedded tools:
Prints content of vox.pdb file into stdout.
vox pdb-dump vox.pdb
To get some syntax highlighting on GitHub define .gitattributes
file in the repository with the following content (docs):
*.vx linguist-language=D
All .vx
files will be highlighted and classified as D.
For more in detail description of implementation see internals.md