A self-hosting language that compiles to native code — no C in the loop.

Krypton is a small, dynamically-typed programming language with a compiler written in itself. kcc source.k produces a native binary on Linux, Windows, and macOS — no gcc, no clang, no external linker required at invocation time.

View on GitHub Quick Start

Current release: kcc 1.4.0 · Apache 2.0

Krypton in 30 seconds

// fibonacci.k
func fib(n) {
    if n <= 1 { emit n }
    emit fib(n - 1) + fib(n - 2)
}

just run {
    let i = 0
    while i < 10 {
        kp("fib(" + i + ") = " + fib(i))
        i += 1
    }
}
$ kcc fibonacci.k -o fib
$ ./fib
fib(0) = 0
fib(1) = 1
fib(2) = 1
...
fib(9) = 34

What makes Krypton different

Self-hosting

The compiler is written in Krypton. kcc compiles its own source, byte-for-byte. Five thousand lines of Krypton, one bootstrap seed per platform, no external dependencies.

Native, no C

The default pipeline emits ELF / PE / Mach-O directly — hand-rolled instruction encoding, direct syscalls on Linux, ad-hoc SHA-256 code signing on macOS. No gcc or clang required to ship a binary.

Cross-platform

Linux x86_64, Windows x86_64, macOS arm64. git clone and run — prebuilt seed binaries ship in the repo, so end users never bootstrap from C.

Small & readable

Dynamic, string-typed value model — one runtime type, no hidden coercion machinery. The whole language fits in a single EBNF page.

~150 builtins

I/O, strings, math, lists, maps, structs, floats, exceptions, StringBuilder, environment helpers — all natively wired on the Linux pipeline, with the C-emit path covering everything else.

Familiar syntax

func, if/else, while, for-in, match, try/catch, structs with dot access, backtick string interpolation. No surprises if you’ve written C, Go, or JavaScript.

Install

Nothing to compile. Clone, run.

# Linux / macOS / WSL
git clone https://github.com/t3m3d/krypton
cd krypton && ./build.sh

# Windows (PowerShell or cmd)
git clone https://github.com/t3m3d/krypton
cd krypton && bootstrap.bat

Smoke test runs examples/fibonacci.k through the native pipeline.

Explore

The repo ships 84 example programs, 35 textbook algorithms (sorts, DP, graph, KMP, Dijkstra, …), 25 tutorial lessons, and a stdlib of ~36 modules. Pick a starting point:

Tutorial · Examples · Algorithms · Language Spec · Changelog