Compiler Overview
This page explains how the Klar compiler workspace is organized.
Workspace Crates
klar-lexer: tokenization and spansklar-ast: syntax tree data structuresklar-parser: source to AST parsingklar-typeck: semantic/type checkingklar-codegen-js: JavaScript backendklar-codegen-llvm: LLVM backend (native + IR)klar-pkg: manifest and lockfile supportklar-compiler:klarCLI binaryklar-lsp: language server binary
Pipeline
For most compiler commands:
- Lex source (
Lexer::tokenize) - Parse tokens into AST (
klar_parser::parse) - Type-check (
TypeChecker::check_program) - Emit target code (JS or LLVM)
Binaries
klar: CLI for compile/run/check/test/tooling tasksklar-lsp: LSP server for editor integration