How programming-language-xiao/xiao works
Xiao is an in-development programming language and toolchain: Rust contains language semantics and execution components, while TypeScript provides the CLI/REPL boundary. The principal workflow is a user command or REPL input passing through the CLI protocol client to the Rust driver, then into language processing and a run/build/package operation. README documents static language analysis, configuration, modules, lifecycle, runtime, package management, environments, bytecode and LLVM paths. Some subsystems are documented but their wiring was not sampled; those links are omitted or marked planned.
Main entry points: frontend.rs Language frontend · main.ts CLI entry · index.ts Command dispatch · service.rs Protocol service
Components 21
CLI and REPL
- CLI entry
cli/ts/src/main.ts - Argument parser
cli/ts/src/commands/parser.ts - Command dispatch
cli/ts/src/commands/index.ts - REPL session
cli/ts/src/repl/session.ts
Core Protocol
- Protocol client
cli/ts/src/protocol/client.ts - Protocol service
core/rust/crates/xiao-driver/src/protocol/service.rs
Language Core
- Language frontend
core/rust/crates/xiao-driver/src/frontend.rs - Lexer and parser
core/rust/crates/xiao-syntax/src/parser.rs - Static semantics
core/rust/crates/xiao-types/src/lib.rs - Module resolution
core/rust/crates/xiao-modules/src/lib.rs - Config parsing
core/rust/crates/xiao-config/src/parser.rs - Lifetime planning
core/rust/crates/xiao-lifetime/src/lib.rs - Structured diagnostics
core/rust/crates/xiao-diagnostics/src/lib.rs
Execution Paths
- Typed IR
core/rust/crates/xiao-ir/src/lib.rs - Bytecode lowering
core/rust/crates/xiao-bytecode/src/lower/mod.rs - Bytecode VM
core/rust/crates/xiao-vm/src/lib.rs - LLVM backend
core/rust/crates/xiao-codegen-llvm/src/lib.rs - Runtime
core/rust/crates/xiao-runtime/src/lib.rs
Packages and Environments
- Package management
core/rust/crates/xiao-package/src/lib.rs - Environment commands
cli/ts/src/environments/index.ts
Other components
- CLI user
Connections 22
- CLI user → CLI entry: invokes
- CLI entry → Argument parser: parses arguments
- CLI entry → Command dispatch: dispatches command
- CLI entry → REPL session: starts session
- Command dispatch → Protocol client: sends requests
- REPL session → Protocol client: runs source
- Protocol client → Protocol service: frames requests
- Protocol service → Language frontend: dispatches run
- Language frontend → Lexer and parser: parses source
- Language frontend → Static semantics: checks semantics
- Language frontend → Module resolution: resolves imports
- Language frontend → Config parsing: parses configuration
- Language frontend → Lifetime planning: plans releases
- Language frontend → Structured diagnostics: reports errors
- Language frontend → Typed IR: produces typed IR
- Protocol service → Package management: dispatches package operation
- Command dispatch → Environment commands: handles environment command
- Typed IR → Bytecode lowering: lowers to bytecode
- Bytecode lowering → Bytecode VM: executes bytecode
- Typed IR → LLVM backend: feeds native backend
- Bytecode VM → Runtime: uses runtime
- LLVM backend → Runtime: targets runtime ABI