Lumi is a custom programming language with a Rust-based engine inspired by the design and performance characteristics of Google’s V8 JavaScript engine. Lumi is built from the ground up with modular, well-typed components to tokenize, parse, analyze, and eventually execute Lumi programs.
Lumi is designed for:
- Custom syntax and semantics
- Static type checking
- Bytecode-based execution
- High performance and safety (thanks to Rust)
lumi_v3/
├── crates/
│ ├── lumi_lexer/ # Lexical analysis
│ ├── lumi_ast/ # Abstract Syntax Tree
│ ├── lumi_parser/ # Syntax analysis
│ ├── lumi_semantic/ # Semantic analysis
│ ├── lumi_bytecode/ # Bytecode generation
│ ├── lumi_vm/ # Virtual Machine
│ ├── lumi_runtime/ # Runtime environment (TBD)
│ ├── lumi_gc/ # Garbage collection (TBD)
│ └── lumi_api/ # Public API (TBD)
├── tests/ # Integration tests (TBD)
├── docs/ # Design docs & specifications
└── Cargo.toml # Workspace configuration┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Source Code │───▶│ Lexical │───▶│ Syntax │
│ lumi lang │ │ Analysis │ │ Analysis │
└─────────────────┘ └─────────────────┘ └─────────────────┘
│ │
▼ ▼
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Bytecode │◀───│ Semantic │◀───│ Abstract │
│ Execution │ │ Analysis │ │ Syntax Tree │
└─────────────────┘ └─────────────────┘ └─────────────────┘
│
▼
┌─────────────────┐
│ Runtime │
│ Environment │
└─────────────────┘
-
Input: Source code string
-
Output: Stream of tokens
-
Features:
- Position tracking
- Token recovery
- Unicode-ready (WIP)
pub fn tokenize(source: &str) -> Result<Vec<Token>, LexError>-
Input: Token stream
-
Output: Tree-based program structure
-
Features:
- Source location tracking
- Visitor pattern support
pub enum Node { /* ... */ }
pub trait Visitor { /* ... */ }-
Input: Tokens
-
Output: AST
-
Features:
- Recursive descent parsing
- Error recovery
- ParseResult with error context
pub fn parse(tokens: &[Token]) -> ParseResult<Node>-
Input: AST
-
Output: Type-checked AST
-
Features:
- Type checking
- Scope validation
- Semantic error handling
pub fn analyze(ast: &Node) -> Result<(), Vec<SemanticError>>- Input: AST
- Output: Lumi Bytecode
- Features:
- Instruction generation
- Constant pool optimization
- Expandable for custom instruction sets
- Symbol table for variable management
- Maps variable names to indices for efficient storage and lookup
- Ensures correct variable scoping and access during bytecode generation
- Automatically assigns indices to new variables and reuses them for subsequent references
pub fn generate(ast: &Node) -> Bytecode- Input: Lumi Bytecode
- Output: Runtime execution result
- Features:
- Stack-based execution model
- Register and call frame support
- Instruction interpretation
pub fn execute(bytecode: &Bytecode) -> Result<Value, VMError>- Purpose: Runtime environment and value system
- Features:
- Context handling
- Object and function models
- Value representation for dynamic types
Common crates used:
# Check formatting
cargo fmt --all
# Build the entire workspace
cargo build --all
# Run all tests
cargo test --all- Lexer
- Parser
- AST
- Semantic Analyzer
- Bytecode Generator
- Virtual Machine
- Garbage Collector
- Runtime
- Public API
Note: While the foundational crates (lumi_lexer, lumi_ast, lumi_parser, lumi_semantic, lumi_bytecode, lumi_vm and lumi_runtime) are implemented, they are actively under development. Functionality is expanding as Lumi evolves into a more expressive and capable language. Expect breaking changes, experimental features, and rapid iteration.
This project is licensed under the MIT License. See LICENSE for details.