Get started
Installing kaikai
The command-line tool is called kai. You can
install it via Homebrew (quick) or build it from source (if
you want to contribute to the language).
Homebrew · macOS and Linux
The official distribution lives in its own tap.
brew install kaikailang-org/kaikai/kaikai Verify the install:
kai --version
If clang is on your PATH (on macOS,
run xcode-select --install to get the Xcode
Command Line Tools), kai uses the LLVM backend by
default. Otherwise it falls back to the C backend, which works
on any machine with a standard cc.
From source
To hack on the compiler or track main, clone the
repo and build the three-stage bootstrap:
git clone https://github.com/kaikailang-org/kaikai
cd kaikai
make tier0
The first ./bin/kai invocation compiles whichever
stage binaries are missing; subsequent calls reuse them.
Stages 0 and 1 only need a C99 cc; stage 2 is the
user-facing path.
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.