Skip to content

vein-lang/vein

Repository files navigation


Vein is an open source experimental high-level strictly-typed programming language with a standalone OS, arm and quantum computing support.


OS Support

OS Version Architectures
Windows 10 1607+ x64, ARM64
OSX 10.14+ x64
Linux x64, ARM64

Compiling from source

Building on Windows

For building, you need the following tools:

  • dotnet 6.0
  • Win10 SDK
  • vsbuild-tools-2019 with MSVC 2019, MSVC142 for ARM64

Checkout vein sources

git clone https://github.com/vein-lang/vein.git --recurse-submodules
cd ./vein-lang
git fetch --prune --unshallow --tags

dotnet restore

Compile IshtarVM

Go to ishtar folder

cd ./runtime/ishtar.vm

Compile for Windows 10 x64

dotnet publish -r win10-x64 -c Release

Compile for Windows 10 ARM64

dotnet publish -r win-arm64 -c Release

Copy output files

mkdir output
cp -R ./runtime/ishtar.vm/bin/net6.0/win10-x64/native/ ./output

The output folder should contain:

  • ishtar.exe - main ishtar file
  • ishtar.exp - export metadata for main module
  • ishtar.lib - dynamic library for main module
  • ishtar.pdb - debug symbols

Compile veinc

Go to vein compiler folder

cd .\compiler

Compile

dotnet publish -r win-x64 -c Release

Copy the output files

mkdir output
cp -R ./bin/Release/net6.0/win-x64/publish ./output

The output folder should contain:

  • veinc.exe - main executable compiler file

Building on Linux (on ubuntu)

For building, you need the following tools:

  • dotnet 6.0
  • clang
  • zlib1g-dev
  • libkrb5-dev
  • libssl-dev

and additional for arm64 (or maybe using prebuiled docker image)

  • clang-9
  • binutils-arm-linux-gnueabi
  • binutils-aarch64-linux-gnu
  • crossbuild-essential-arm64
  • gcc-multilib
  • qemu
  • qemu-user-static
  • binfmt-support
  • debootstrap

Checkout mana sources

git clone https://github.com/vein-lang/vein.git --recurse-submodules
cd ./vein-lang
git fetch --prune --unshallow --tags

dotnet restore

Compile IshtarVM

Go to ishtar folder

cd ./runtime/ishtar.vm
Compile for Linux x64
dotnet publish -r linux-x64 -c Release

Compile for Linux ARM64

cd ./cross
sudo ./build-rootfs.sh arm64
cd ..
cd ./runtime/ishtar.vm
dotnet publish -r linux-arm64 -c Release -p:CppCompilerAndLinker=clang-9 -p:SysRoot=/home/.tools/rootfs/arm64

Copy output files

mkdir output
cp -R ./runtime/ishtar.vm/bin/Release/net6.0/linux-x64/native ./output

Compile veinc

Go to vein compiler folder

cd ./compiler

Compile

dotnet publish -r linux-x64 -c Release

Copy output files

mkdir output
cp -R ./bin/Release/net6.0/linux-x64/publish ./output

The output folder should contain:

  • veinc - main executable compiler file

Contributing

We welcome everyone to contribute to vein language. To do so, you need to know a couple of things about the folder structure::

/runtime: folder contains all backend vm\generator for vein
  /common: shared code
  /ishtar.base: base abstraction for generator\vm
  /ishtar.generator: logic of IL generator for IshtarVM
  /ishtar.vm: implementation of ishtar vm in C#
/compiler: folder contains source for vein compiler
/lib: folder with common libraries
  /ast: mana AST library, for parsing
  /projectsystem: project system models, for compiler
/lsp: language server for vein lang
/samples: Wow! its samples!
/test: folder with various tests

You can run all tests from the root directory with dotnet test.

To recompile the vm and the compiler: dotnet build.

To recompile the standard library: veinc ./vein.std/corlib.vproj.

After your changes are done, please remember to run dotnet format to guarantee all files are properly formatted and then run the full suite with dotnet test.

Q\A

Q:
  Why it based on C#?
A:
  Initially, i started developing a virtual machine in C++,
  but there were a lot of difficulties with basic things (such as collections, text formatting, etc.)
  And at some point i saw that microsoft began to develop a fully AOT compiler for dotnet.
  That means we could write in pure C# without using runtime and std, 
  which allows everyone to write such hard things like an OS!
  So I decided - that's it! I'm Definitely writing a virtual machine in C#!

  So, now I'm developing using the C# runtime and the std, but 
  in version 2.0 I'm planning to completely move away from runtime dependencies.

Q:
  This language really support quantum computing?
A:
  Not now, but in future I'm planning to add support for Microsoft Quantum Simulator, 
  next - support for Azure Qunatum or IBM quantum cloud.
  And after the release of stationary quantum extension card (like PCEx128 😃), 
  I'll add support for them too.

Special Thanks

License

Vein Lang is primarily distributed under the terms of both the MIT license and the Apache License (Version 2.0), with portions covered by various BSD-like licenses.

Check LICENSE files for more information.

Support