A new programming language called Shaft is attempting to match Rust's safety guarantees while remaining more readable and easier to use. The project is at an early stage, with a C++ and LLVM bootstrap compiler and a self-hosted compiler in development, but the tooling and build infrastructure are already functional enough to compile and run programs.

What Shaft actually is

Shaft is a compiled language that uses LLVM as its backend. The bootstrap compiler is written in C++17 and requires LLVM 18 development files, CMake 3.20 or later, and Python 3.11. It reads source files, follows relative import directives, resolves each module once, rejects dependency cycles, and compiles the complete dependency graph as separate source modules.

The language supports multiple emit modes: binary, LLVM IR, object files, assembly, static libraries, and dynamic libraries. Cross-compilation is supported through LLVM target triples. The compiler validates targets through LLVM and selects the appropriate target machine for each emit mode. Native emission for the current CPU is supported with a flag that is rejected when an explicit cross target is set, because host ISA features are not portable.

The build system uses a TOML-like format called Shaft.build. It supports quoted strings, arrays, boolean values, comments, and two tables: package metadata and build configuration. Unknown tables and keys are errors, so configuration typos do not silently change a build. Entry points, output paths, and library directories are resolved relative to the build file, not the current directory.

How it compares to Rust

The stated goal is to match Rust's safety while remaining more readable. The syntax, described in a separate document, uses a structure that emphasizes clarity over brevity. Function declarations include explicit return types and variable bindings. The language includes a standard library that is automatically prepended to compilations, with an option for bare compilation when the standard library is not needed.

The project includes benchmarks that compare Shaft against C and Rust. The benchmark script generates equivalent workloads in all three languages, records source sizes, compilation commands, tool versions, host metadata, and binary sizes. The compile workload compares Shaft with no standard library against Clang and rustc, both emitting LLVM IR. The runtime workload uses the same algorithm across all three languages and reports unavailable results when a compiler is not present rather than fabricating comparisons.

The benchmarks are early and limited, but they establish a baseline for tracking performance as the language matures. The fact that the project includes a benchmarking framework at this stage suggests the developers are serious about measuring real performance rather than assuming it.

The tooling that exists today

The repository ships a dependency-free Language Server Protocol implementation and a VS Code extension. The extension provides syntax highlighting, snippets, formatting, structural diagnostics, live compiler error markers, semantic tokens, definitions, symbols, folding, completion, and hover documentation. Hover cards display declarations and optional documentation written as consecutive triple-slash comment lines above declarations.

The install script detects the host OS and architecture, inspects the executable header to verify the binary is built for the correct target, and refuses to install a binary built for a different platform. It registers the compiler for the VS Code language server, including the compiler path, standard library path, and resource paths, so VS Code discovers the installed compiler even when the bin directory is not in the editor's PATH.

The uninstall script removes only the installed compiler, resources, LSP registration, and PATH entries created by the installer. It preserves unrelated files and existing PATH entries. The registration file lives in platform-specific locations and can be overridden by an explicit compiler path setting in VS Code.

What the repository structure tells you

The repository has two main branches. The bootstrap branch contains the C++ and LLVM compiler. The main branch contains the self-hosted compiler, which is written in Shaft itself. This progression from a bootstrap compiler in an established language to a self-hosted compiler in the new language is the standard path for language development. It means the language is mature enough that its own compiler can be written in it.

The test suite runs end-to-end tests across all emit modes and verifies the Linux exit-42 smoke binary. Cross-target verification compiles for Darwin and Windows during CI. The build system generates release packages for the current host OS, including the compiler, standard library, and platform runtime sources.

For developers interested in language design, the Shaft project offers a concrete example of building a language from the ground up with modern tooling. The bootstrap compiler is functional, the build system is documented, the editor integration works, and the benchmarking framework exists. The language itself is still early, but the infrastructure around it is already usable for experimentation and exploration.