kairo

kairo

kairo is the compiler. It is written in Kairo, runs clang and lld in-process, and compiles and links in one command.

kairo main.k -o main          # compile and link
kairo --type-check-only main.k

Common flags

FlagMeaning
-o <file>output name
-c, -Sstop after the object / assembly
--emit=obj,asm,llvm-ir,llvm-bcchoose the outputs
--emit-headers=<dir>write one C++ header per module (Using Kairo in C++)
--type-check-onlyparse and check without generating code
--target=<triple>, --sysroot=<dir>, --freestanding, --nativecross-compilation and sysroots
--progress=auto|always|never|linesthe build status line
--sema-threads=N, --codegen-threads=N, --threads=Nparallelism of type checking and code generation
--interface-pch=auto|on|offshare precompiled Kairo interfaces between files
--cache-dir <dir>, --force-recompileincremental compilation: unchanged files skip code generation
-finfer-purity / -fno-infer-purityinfer const / @pure for functions that make no promise (on by default)
-Wconst-selfopt-in lint for methods that could take const self
--error-format=..., --explain <CODE>, --diag-show-idsdiagnostics: --explain prints the long form of a code
--print-stats, -vtimings, counts, and what each step did
--help, --help-hiddenlist the flags; --help-hidden adds internal and not-yet-implemented ones

Pretty diagnostics show the location as file:line:col. On a terminal a build prints a single status line (parse, sema, codegen with counts) that disappears before any diagnostic appears.

kairo finds its standard library, runtime and clang resources relative to its own location, so an unpacked release runs without flags. python3 build.py stages the same layout when building from source (Installation). See also kcc, kld and kfmt.