A systems language with no runtime and nothing hidden.
Website ·
Install ·
Tour ·
Language guide ·
bolt
Volt is a compiled language with no garbage collector, no vtables, no exceptions and no scheduler:
every method and trait call is resolved at compile time. Values are owned and deleted when their
scope ends, errors are values, generics are templates, and code can run in the compiler. It compiles
to readable C or, through LLVM, to native code; it reads C and C++ headers directly; and its
compiler, voltc, is written in Volt and builds itself.
- C's speed, nothing behind your back. No GC, scheduler, exceptions or vtables; every allocation is one you wrote. On the benchmarks Volt matches or beats clang-compiled C on most programs.
- Mistakes stop loudly. Debug builds catch overflow, out-of-bounds indexing, null unwraps and
double frees; the compiler rejects use after move, missed
matchcases and format strings that don't fit their arguments.--releasedrops the overflow and double-free checks and keeps the rest, each as one compare and a trap. - Ownership without lifetimes. Values are deleted at scope end, moves are tracked and copies are explicit: RAII with nothing to annotate.
- Every language is one step away. It reads C and C++ headers (templates and the standard
library too), and imports Rust crates and Zig, Swift, Kotlin, Go, Java, C#, Python, TypeScript
and JavaScript code the same way, like a header (
use { "geom.rs" } as geom;); Lua embeds through a package. Onebindingsline inbolt.tomlmakes a Volt library usable from 15 languages. - One toolchain. bolt, a language server, and diagnostics that point at the problem.
It's young (no 1.0, no package registry) and has no borrow checker: if you need proven memory safety, use Rust. The Why Volt page has the details and a comparison with C, C++, Rust, Zig and Go.
use std::io;
error parse_error { EMPTY, BAD_DIGIT }
fn parse(s: str) -> parse_error!i32 { // an error, or a value
if (s.len == 0) {
return parse_error::EMPTY;
}
var n = 0;
for (ch) in s {
if (ch < '0' || ch > '9') {
return parse_error::BAD_DIGIT;
}
n = n * 10 + (ch - '0') as i32; // overflow stops the program in debug builds
}
return n;
}
fn main() -> !void {
val a = try parse("42"); // try passes an error up
val b = parse("4x") catch -1; // catch handles it
var seen: std::vec<i32> = {}; // owned: deleted at the end of main
try seen.push(a);
std::println("{} {} {}", a, b, seen.len);
}
// expect: 42 -1 1- Ownership without a collector: deletes run at scope end, moves are tracked, copies are
explicit,
box<T>owns heap memory. Avalcan't change, even through a reference to it passed on, returned or stored in a struct. - Errors as values (
E!T,try,catch,errdefer) and optionals (T?,??, narrowing). - Templates with specialization, packs and constant parameters; traits as constraints, and as tagged unions instead of vtables.
- Comptime: functions,
if,matchandforthat run in the compiler, types as values,@typeinfo. - Async as stackless frames of known size, driven by hand.
- Two backends: readable C, or native code through LLVM (the default on x86-64 and aarch64, except on Windows), with DWARF debug info for gdb in debug builds.
- Embeddable, like Lua:
libvoltvmcompiles Volt source in memory and runs it through LLVM's JIT, with host functions, sandboxes, and C, C++, Rust and Python bindings. - Bare metal with no C at all:
--target riscv32-none,riscv64-none,thumbv6m-none,thumbv7m-noneorthumbv7em-nonebuilds through LLVM and ld.lld with no C compiler, libc or C runtime. - WebAssembly, no C either:
--target wasm32-wasifor WASI hosts (node, wasmtime) andwasm32-nonefor web pages, linked by wasm-ld. - A standard library with collections, text, JSON, files, processes, networking, threads, allocators you choose per container, hashing and encodings.
- Interop: real C headers (unions and bitfields too), C++ classes, templates and the standard
library; Rust crates, Go packages, and Zig, Swift, Kotlin, Java, C#, Python, TypeScript and
JavaScript files imported by name (
use { "fm.zig" } as fm;); Lua through a package; and libraries with bindings for C, C++, Rust, Zig, Python, JavaScript and TypeScript, C#, Java, Go, Lua, Dart, Swift, Kotlin and Ruby. - Tooling: diagnostics that point at the problem, the bolt build tool, a language server, and a VS Code extension.
You need stable Rust, a C compiler, and LLVM 23 with libclang (llvm-c/ and clang-c/ headers; on
Debian and Ubuntu, llvm-23-dev and libclang-23-dev from apt.llvm.org).
cargo build --release # voltc-bootstrap and bolt
cd voltc && ../target/release/bolt build --release && cd .. # voltc, the compiler
export PATH="$PWD/voltc/target/release:$PWD/target/release:$PATH" # for this shell; see the install guide
voltc run examples/tour.voltThen bolt new hello && cd hello && bolt run. The
install guide has the details.
| Path | |
|---|---|
voltc/ |
the compiler, in Volt: checker, typed IR, C and LLVM backends, C/C++ import, language server; voltc/embed builds it into libvoltvm, Volt for embedding |
bootstrap/ |
voltc-bootstrap, the stage0 compiler in Rust that builds voltc the first time |
std/ |
the standard library, an ordinary package |
runtime/ |
the small C prelude and runtime every program includes |
bolt/ |
the build tool, and the API its build files use |
editors/vscode/ |
the VS Code extension |
interop/ |
volt-build (Cargo build scripts) and volt.zig (build.zig): Rust and Zig projects that use Volt; npm and pip: install scripts that build a Volt library for an npm or pip package; python, java, dotnet and lua: packages for Volt programs that call Python, Java, .NET and Lua; node: Node.js addons written in Volt |
site/ |
the website and documentation: Markdown pages, and site/gen, the generator (in Volt) that builds them |
examples/, tests/ |
the tour and example programs; the test suites |
assets/logo/ |
the logo, drawn by logo.ts |
cargo test # goldens, bolt, interop, the language server, the docs
cd voltc && VOLTC=../target/release/voltc-bootstrap ../target/release/bolt build bootstrapThe second command is the bootstrap check: voltc rebuilds itself until two stages produce the same C, then through LLVM, and runs the golden suite on both backends. See Internals and Contributing.
Volt is young. The LLVM backend is the default on x86-64 and aarch64; Windows builds through C until voltc can be tested there. There's no package registry (bolt uses paths and git). std's OS code has branches for macOS, FreeBSD and Windows, which the tests compile for each of them, but they run on Linux only.
Volt is licensed under either of the MIT License or the Apache License, Version 2.0, at your option.