How coderscreative/calibre-lang works
Calibre is a statically typed language with a CLI/REPL, compiler pipeline, stackless bytecode VM, formatter, and language server. The primary workflow takes source through parsing, semantic analysis and type inference, LIR/bytecode preparation, then VM execution; CLI commands also expose checking, testing, and packaging. The README documents the pipeline and major language/runtime capabilities. Sampled excerpts confirm CLI dispatch, parser and formatter behavior, VM construction, and LSP document handling; unsampled subsystem links are limited to documented relationships.
Main entry points: src/lib.rs Engine API · src/lib.rs Bytecode VM · src/lib.rs Lexer and parser · src/lib.rs Semantic MIR
Components 18
User tools
- CLI and REPL
calibre/src/main.rs - CLI commands
calibre/src/commands/mod.rs - Engine API
calibre/src/lib.rs - Formatter
fmt/src/lib.rs
Compiler pipeline
- Lexer and parser
crates/parser/src/lib.rs - Syntax AST
crates/parser/src/ast/mod.rs - Semantic MIR
crates/mir/src/lib.rs - Type inference
crates/mir/src/typing.rs - LIR lowering
crates/lir/src/lib.rs
Execution runtime
- Bytecode conversion
crates/vm/src/conversion/mod.rs - Bytecode VM
crates/vm/src/lib.rs - Native runtime
crates/vm/src/native/stdlib/mod.rs
Editor services
- Language server
lsp/src/main.rs - Editor handlers
lsp/src/features/handlers.rs - Diagnostics
lsp/src/features/diagnostics.rs
Language support
- Calibre stdlib
crates/std/src/lib.rs - FFI bindings
crates/vm/src/value/ffi/mod.rs
Other components
- Language user
Connections 20
- Language user → CLI and REPL: runs commands
- Language user → Formatter: formats source
- Language user → Language server: connects editor
- CLI and REPL → CLI commands: dispatches
- CLI commands → Engine API: runs engine
- Engine API → Lexer and parser: parses source
- Lexer and parser → Syntax AST: produces AST
- Syntax AST → Semantic MIR: lowers semantics
- Semantic MIR → Type inference: infers types
- Semantic MIR → LIR lowering: lowers to LIR
- LIR lowering → Bytecode conversion: prepares bytecode
- Bytecode conversion → Bytecode VM: creates VM code
- Engine API → Bytecode VM: executes program
- Bytecode VM → Native runtime: calls builtins
- Bytecode VM → FFI bindings: bridges externs
- Engine API → Calibre stdlib: loads standard library
- Formatter → Lexer and parser: parses input
- Language server → Editor handlers: routes requests
- Editor handlers → Diagnostics: requests diagnostics
- Editor handlers → Lexer and parser: parses documents