reference compiler · v0 in progress
A natively-compiled language exploring the C++ proposals that deserved a second life. Familiar semantics, distilled — proposal-inspired, not proposal-compatible.
curl -fsSL https://raw.githubusercontent.com/kinglet-lang/bootstrap/canon/scripts/install.sh | sh
about
The proposals that didn’t make it.
Kinglet takes the WG21 proposals that C++ deferred or rejected and gives them a second life — adapting syntax and semantics wherever adaptation makes the language smaller, clearer, or more coherent. It is proposal-inspired, not proposal-compatible.
Familiar territory underneath: structs, enums, monomorphized generics, pattern matching, and expression functions. The reference compiler is written in C++ — a handwritten lexer and parser, a type checker, a KIR middle-end, and an LLVM native backend.
It is early. The reference compiler is what you install today; a self-hosting native toolchain is the goal.
syntax
Familiar, with a few second lives.
C++-ish at the surface — braces, value semantics, fixed-width integers. Underneath sit the proposals that didn’t make it: concepts, uniform function call, tagged enums with pattern matching, nullable types with coalescing, and a pipe operator.
using io; struct Box<T> { T value; } T identity<T>(T x) => x; int main() { Box<int> bi { 42 }; io::out("{}\n", identity<int>(99)); return 0; }
enum Shape { Circle(float), Rect(float, float), None, } float area(Shape s) { return s match { Shape::Circle(let r) => 3.14 * r * r, Shape::Rect(let w, let h) => w * h, Shape::None => 0.0, }; }
concept Printable<T> { string to_string(T value); } string to_string(int v) { return "n"; } int main() { int n = 42; string s = n.to_string(); // uniform function call return s.len(); }
int? parse_int(string s) { return int(s)? * 10; } int main() { int? a = int("123") ?: -1; int n; try { n = int("bad")?; } catch (let ex: CastError) { n = -99; } return n; }
Every snippet above is lifted from the compiler’s runnable test suite — nothing invented.
install
A few more knobs.
-
▸ a specific version
Pin a tag, or pull a prerelease the one-liner skips by default.
KINGLET_VERSION=v0.1.0-rc.3 -
▸ verify it
kingletlands on your PATH.kletis a hard link to the same binary.kinglet --version - ▸ no installer Grab a release archive and add its directory to your PATH. releases →
ecosystem
The four repositories.
- kinglet Language design, architecture decisions, and the self-hosting effort. kinglet-lang/kinglet →
- bootstrap The C++ reference compiler. This is the binary on your PATH. kinglet-lang/bootstrap →
-
perch
VS Code extension —
.klhighlighting, diagnostics, and a native language server. kinglet-lang/perch → - crest A dark VS Code color theme drawn from the Kinglet palette. kinglet-lang/crest →