Start

Installation

There's no installer and no package to download — you build the compiler from source. It's a single Go binary once built, and a compiled program links nothing beyond plain libc unless it actually uses a feature that needs more.

Core toolchain

Two things are always required:

  • Go 1.26+ — builds the compiler itself (see go.mod for the exact pinned version).
  • clang (LLVM 15+, opaque-pointer support) — the backend that turns emitted LLVM IR into a native binary.

macOS (Apple Silicon or Intel)

shell
# Homebrew — https://brew.sh
$ brew install go llvm
# clang from the llvm formula, or use Xcode's:  xcode-select --install

Debian / Ubuntu

shell
$ sudo apt-get update
$ sudo apt-get install golang clang

Alpine

shell
$ apk add go clang

Clone & build

shell
$ git clone https://github.com/memphisx/KlainMainLang
$ cd KlainMainLang
$ make build            # → ./klainmain

That produces ./klainmain in the repo root. Point it at a .ts file and run the binary it writes next to the source:

shell
$ ./klainmain examples/basics/basics.ts   # → examples/basics/basics
$ ./examples/basics/basics                # run it yourself

Optional feature libraries

Every library below is linked only when your program uses the feature — the same conditional-linking convention throughout. A program that never touches these stays plain-libc, so install a library only when you hit the feature that needs it.

FeatureLibraryInstall
fetch / http.listenlibcurlbrew install curl · apt-get install libcurl4-openssl-dev · apk add curl-dev
http.listen (h2c)libnghttp2brew install nghttp2 · apt-get install libnghttp2-dev · apk add nghttp2-dev
RegExplibpcre2-8brew install pcre2 · apt-get install libpcre2-dev · apk add pcre2-dev
crypto.subtle / tls / wss://OpenSSL 3brew install openssl@3 · apt-get install libssl-dev · apk add openssl-dev
bigintlibtommath (default)brew install libtommath · apt-get install libtommath-dev · apk add libtommath-dev
-mm=gc (opt-in GC)bdw-gc / libgcbrew install bdw-gc · apt-get install libgc-dev · apk add gc-dev

crypto.getRandomValues / randomUUID use the OS CSPRNG directly and need no library. On macOS, -crypto=commoncrypto uses the built-in CommonCrypto with zero install. GMP is an alternative bigint backend via -bigint=gmp.