Get started
Installing kaikai
The command-line tool is called kai. The
recommended path is the official installer; Homebrew also
works, and you can build from source if you want to change
the compiler itself.
Official installer · macOS (Apple Silicon)
A rustup-style installer with no dependencies:
curl -fsSL https://raw.githubusercontent.com/kaikailang-org/kaikai/main/install.sh | sh
It downloads the latest release, verifies its SHA-256,
installs it under ~/.kaikai/ and adds
~/.kaikai/bin to your PATH. Verify
the install:
kai --version
The binary is self-contained: LLVM is statically linked, and
it compiles to native code with no clang or
external toolchain. To update later:
kai upgrade Homebrew
The official distribution also lives in its own tap.
brew install kaikailang-org/kaikai/kaikai
On a Homebrew install, updates go through
brew upgrade kaikai, not kai upgrade.
From source
You only need this to change the compiler itself, or on
platforms the installer does not ship binaries for yet
(prebuilts today are macOS on Apple Silicon). It requires a
cc and the LLVM development headers (located via
llvm-config):
git clone https://github.com/kaikailang-org/kaikai
cd kaikai
make all
The bootstrap regenerates the compiler from nothing but a C
compiler: stage 0 (C) builds kaic0, which
compiles the minimal compiler kaic1, which
compiles the full self-hosted compiler.
Your first program
Save this as hello.kai:
fn main() {
println("hello, kaikai")
}Then run it:
kai run hello.kai
# hello, kaikai To produce a native binary instead of running directly:
kai build hello.kai -o hello
./hello What's next
- Browse the examples.
- Read the book for the long-form walkthrough of the language with real programs.
- Visit the GitHub repo and open an issue if something seems off.