Skip to main content

Running & Building

Klar currently processes one file at a time.


Run

kc run src/main.kl

The Execution Pipeline:

  1. Lex: Tokenization of source.
  2. Parse: Abstract Syntax Tree (AST) generation.
  3. Type-check: Semantic validation.
  4. Transpile: Conversion to Java source code.
  5. Compile: Invocation of javac on the generated source.
  6. Run: Invocation of java on the resulting bytecode.

Build only

kc build src/main.kl

This generates output into out/:

  • *.java
  • *.class

Debugging Commands

Parse only

Used to verify the grammar and AST structure.

kc parse src/main.kl

Lex only

Used to verify tokenization.

kc lex src/main.kl
kc lex src/main.kl -st # or '--show-tokens', both show a token table.