KlainMainLang
A TypeScript-to-native compiler, written in Go, that emits LLVM IR and hands it to clang. You write .ts, it writes .ll, clang writes a real executable.
Personal / experimental project. One person, building this for fun and to learn how compilers actually work. Not audited, not hardened, no stability guarantees between commits. Perfect for tinkering, small CLI toys, and Docker microservices — bring your own garbage collector, or pass
-mm=gcand let it bring one for you.
Where to go next
Getting started
Build the compiler, compile your first .ts file, run the binary.
Language guide
Types, generics, classes, modules, async/await — and the sharp edges.
Standard library
http, fetch, fs, workers, crypto, streams, process.
CLI & flags
Commands, memory modes, backends, --static and friends.
At a glance
- The language is basically all there (~95%). Classes, generics, closures,
async/await, unions, generics with constraints, mapped & conditional types. - You can write a real server.
http.listenspeaks HTTP/1.1 and HTTP/2,fsreads and writes,worker_threadsandclustergive you real OS threads and processes, TLS on both ends. - Browser-shaped APIs that make sense off-browser.
fetch,URL,WebSocket, Web Crypto, Streams,AbortController, timers. - What'll bite you. A bare
: numberis a JS-faithful double; reach for a sizedint8…uint64type when you want integer semantics. Concurrency is cooperative. Nothing is dynamic. All deliberate — see the coverage matrix.