Compiler backends

Current backend

The current backend uses a Bytecode representation of the program which will run in a Virtual machine that implements garbage collection. This is similar to Python's approach to running programs, but however as we all know, Python is incredibly terrible for performant code (unless using C bindings).

We want to move away from using a Virtual machine as the main backend and actually provide executables that can be run on x86_64 backend using either a native (naive) backend, and LLVM.

However, there are advantages to having a VM implementation for the language, which are primarily:

  • We can have an interactive mode, execute code on the fly (with a minor performance hit)
  • We can run compile-time code functions that are beyond just templates and constant folding expressions.

Planned backends

Here are the currently planned backends, that will be worked on and stabilised some time in the future:

NameDescriptionTarget platformStatus
x86_64_nativeA native backend for generating executables and performing optimisations ourselves.x86_64
x86_64_llvmAn backend powered by the might of LLVM backend.x86_64
vmVirtual machine backend able to run bytecode compiled programs.any
elf64Backend for generating standalone ELFs for un-named host operating systems.i386
wasmWebAssembly backend, convert hash programs into WebAssembly executablesbrowser/any
jsJS backend, generate TS/JavaScript code from the provided program.browser/any