Hello, world¶
Save this to hello.kt:
fun main() {
println("Hello, klio!")
val xs = listOf(1, 2, 3)
println(xs.joinToString { "${it * it}" })
}
Run it:
Running a module¶
When klio run gets more than one file, every file's top-level
declarations are visible to every other file — single-module
semantics. Exactly one fun main() must exist across the module.
Type-checking without running¶
klio check resolves names and type-checks, emits diagnostics, and
exits non-zero on any error. It does not run the program. Pass
--format json or --format sarif to integrate with editors and
CI; the default is plain.
What just happened?¶
klio run walked your source through:
- Lexer — UTF-8 source → token stream.
- Parser — tokens → AST (
ast.KotlinFile). - Pack loading — the embedded stdlib (and any installed packs your file imports) merge into the module.
- Lowering —
irlowers the AST to register IR. - Vm —
interp_irbuilds the IR module and runs it.
klio check takes a different path after parsing: it runs the
resolver and type checker to produce diagnostics. Type-checking is
not part of klio run.
The
klio replcommand is currently a placeholder that echoes input. Useklio runfor execution.