CLI Reference
Common Commands
| Command | Purpose |
|---|---|
klar lex <file> |
Print token stream |
klar parse <file> |
Parse and summarize AST |
klar build <file> |
Compile file (default JS) |
klar run <file> |
Compile and execute |
klar test <file> |
Run test blocks |
klar check <file> |
Parse + type-check |
klar fmt <file> |
Format source |
klar lint <file> |
Emit lint warnings |
klar bench <file> |
Run benchmark-style tests |
klar doc <file> |
Generate markdown API docs to stdout |
Build Targets
Default JS output:
klar build examples/hello.klar
Native binary:
klar build examples/native_hello.klar --target native
LLVM IR:
klar build examples/hello.klar --target llvm-ir
JSON Diagnostics for Tools
klar check examples/demo.klar --format json
Returns [] on success or a JSON array of diagnostics on errors.
Package Commands
klar init my-app
klar add http-server@1.0.0
klar remove http-server