How rils-lang/rils works
Rils is an embeddable Rust-inspired scripting language. The main workflow runs from script or project input through lexing, parsing and semantic analysis, lowering and bytecode production, then execution by the interpreter or bytecode VM; results are returned to the caller. Separate branches cover project and library artifacts, host integration, and editor analysis. The README documents these capabilities; some implementation details and connections are inferred from module boundaries and package dependencies because their source was not sampled.
Main entry points: lib.rs Rust Engine API · main.rs CLI and REPL · analysis.rs Semantic Analysis · lexer.rs Lexer
Components 22
Language Frontend
- Lexer
crates/rils_frontend/src/lexer.rs - Parser
crates/rils_frontend/src/parser.rs - Semantic Analysis
crates/rils_frontend/src/analysis.rs - Macro Expansion
crates/rils_frontend/src/macros.rs - Built-in Catalog
crates/rils_builtins/src/catalog.rs
Compilation and Artifacts
- Project Model
crates/rils_project/src/lib.rs - HIR Lowering
crates/rils_compiler/src/hir.rs - MIR
crates/rils_compiler/src/mir.rs - Bytecode Format
src/bytecode/format.rs - Bytecode Verifier
src/bytecode/verifier.rs - Library Artifacts
src/library.rs
Runtime Execution
- Interpreter
src/interpreter.rs - Bytecode VM
src/bytecode/vm.rs - Runtime Values
src/value.rs
Embedding and Hosts
- Rust Engine API
src/lib.rs - Host Contracts
crates/rils_compiler/src/host.rs - C ABI
tools/rils-capi/src/lib.rs
Developer Tools
- CLI and REPL
src/main.rs - Language Server
tools/rils-analyzer/src/main.rs - VS Code Extension
editors/vscode-rils/extension.js
Other components
- Script Author
- Embedded Host
Connections 29
- Script Author → CLI and REPL: submits scripts
- Script Author → VS Code Extension: edits scripts
- VS Code Extension → Language Server: LSP requests
- CLI and REPL → Project Model: loads project
- Rust Engine API → Project Model: loads project
- Project Model → Lexer: provides sources
- CLI and REPL → Lexer: compiles input
- Rust Engine API → Lexer: compiles source
- Lexer → Parser: tokens
- Parser → Macro Expansion: expands macros
- Parser → Semantic Analysis: AST
- Semantic Analysis → Built-in Catalog: resolves built-ins
- Semantic Analysis → HIR Lowering: typed program
- HIR Lowering → MIR: lowers to MIR
- MIR → Bytecode Format: encodes module
- Bytecode Format → Bytecode Verifier: verifies module
- Rust Engine API → Interpreter: evaluates source
- Rust Engine API → Bytecode VM: executes module
- CLI and REPL → Bytecode Verifier: verifies files
- CLI and REPL → Bytecode VM: runs bytecode
- Rust Engine API → Library Artifacts: loads libraries
- Bytecode VM → Runtime Values: produces values
- Interpreter → Runtime Values: produces values
- Embedded Host → Rust Engine API: embeds runtime
- Embedded Host → C ABI: calls C ABI
- C ABI → Rust Engine API: uses runtime
- Host Contracts → Rust Engine API: defines host ABI
- Language Server → Project Model: indexes workspace
- Language Server → Semantic Analysis: analyzes documents