CVast++ is the official C++ implementation of the Vast Programming Language. It is a complete rewrite, which now instead of the previously slow and unstable interpreter, it has a fast and dependable compiler. The compiler is written in C++ and uses the LLVM library to generate the machine code.
Vast is a set of programming languages following the same syntax. It is meant to give the programmer utmost freedom when coding, allowing customization previously unseen in other languages. The language is still in development, and as such, the number of keywords may change.
Getting started is simple.
- Clone the repository in home directory (optional)
cd ~
git clone https://github.com/Silicon27/Vast.git
- Export the path to the Vast directory in
.bashrc
,.bash_profile
or.zshrc
file (depending on your shell) and creating an alias for the CVast Executable
nano ~/.bashrc
export PYTHONPATH=~/Vast:$PYTHONPATH
alias vast=~/Vast/cmake-build-debug/Vast
Also add the stdlib
to the path
export CVASTSTDLIB="$HOME/Vast/cvast/stdlib/"
Warning
Path to stdlib may vary depending on installation zone, so just get the directory of stdlib for you.
Exit the editor by pressing
Ctrl + X
, thenY
and finallyEnter
Warning
If your wish to install Vast in a different directory then the above step would be different. Make sure to replace the path with the correct path to the Vast directory. This also applies in the case your shell is not bash.
- Source the file
source ~/.bashrc
And you are done!
You can now run the vast
command in your terminal to run the Vast Compiler.
vast ~/Vast/examples/cvast/test/test.cv -o output.s
CVast takes inspiration from Rust, C++, Python, and other languages.
A simple function for adding two numbers would look like this:
fn add(a: i32, b: i32) -> i32 {
return a + b;
}
var
is used to declare variables:
var a: i32 = 10;
if
statements are similar to that of C++:
if (a == 10) {
return true;
} else {
return false;
}