Workflow
A typical Karkain development loop — scaffold, write, build, run, test, format, lint, then cross-compile when needed.
1. Scaffold the project
$ karkain new my_project
$ cd my_project
Creates karkain.toml, src/main.kark and tests/main_test.kark.
2. Write code
// src/main.kark
func square(n) {
return n * n
}
println(square(7))
3. Type-check
karkain check validates syntax and semantics without producing a binary:
$ karkain check src/main.kark
[ok]
4. Build
$ karkain build src/main.kark -o build/app.exe
5. Run
$ karkain run src/main.kark
49
6. Write tests
// tests/math_test.kark
func test_square() {
assert_eq(49, square(7))
}
7. Run tests
$ karkain test tests/
...
=== Test Summary: 1 test, 1 passed, 0 failed, 0 skipped ===
8. Format
karkain fmt canonicalizes formatting; --check only verifies:
$ karkain fmt src/main.kark
$ karkain fmt --check src/main.kark # non-zero if not canonical
9. Lint
karkain lint runs the full front-end analysis (including the borrow
checker) and surfaces warnings:
$ karkain lint src/main.kark
10. Cross-compile (when needed)
Build for another architecture/OS with an explicit --target triple:
$ karkain build src/main.kark --target x86_64-linux -o build/app_linux
$ karkain target # list the supported matrix
Cross-built binaries cannot be run on the host (karkain run --target
<foreign> is refused with an emulator/remote-target hint, exit code 6).
Summary
check— type checking onlybuild— compile to a native executablerun— compile and execute in one steptest— discover and run*_test.karkfmt— canonical formatting (--checkto verify)lint— full front-end analysis and warningstarget— the supported compilation targets
See also
The steps are documented in turn: Build, Run, Test, Debug, Profile and, for cross-compilation, Cross-Compilation. For the full command surface see Command-Line Interface.