How muaraai/mora works
Mora is an AI-oriented programming language and toolchain. A user invokes its CLI on .mr source; the shared front end tokenizes, parses, resolves imports, and checks types/shapes before execution or compilation. The main runtime branches are the interpreter, bytecode VM, and native C99 AOT path. Tensor/autograd, GGUF, agent and standard-library capabilities are represented alongside editor-facing LSP and formatting. Some subsystem edges rely on README descriptions because their implementation files were not excerpted; unsampled details are not inferred.
Main entry points: cli.rs Mora CLI · interpreter.rs Tree-Walking Interpreter · ir.rs Mora IR · lsp.rs Language Server
Components 20
Language Front End
- Lexer
src/lexer.rs - Parser and AST
src/parser.rs - Import Resolver
src/module_loader.rs - Type and Shape Checker
src/checker.rs - Diagnostics
src/diagnostic.rs
Execution Runtime
- Tree-Walking Interpreter
src/interpreter.rs - Agent and I/O Runtime
src/runtime.rs - Python Bridge
src/py_bridge.rs - GGUF Weights and Checkpoints
src/gguf.rs - Standalone Bundler
src/bundler.rs
Tensor and Compilation
- Tensor and Transformer Ops
src/tensor.rs - Reverse-Mode Autograd
src/autograd.rs - Mora IR
src/ir.rs - Arena Memory Planner
src/arena_planner.rs - Bytecode VM
src/vm.rs - Native C99 Generator
src/codegen_native.rs
Developer Tooling
- Mora CLI
src/cli.rs - Language Server
src/lsp.rs - Source Formatter
src/fmt.rs
Other components
- Language User
Connections 27
- Language User → Mora CLI: invokes
README.md - Mora CLI → Lexer: starts front end
src/cli.rs - Lexer → Parser and AST: tokenizes for
src/parser.rs - Parser and AST → Import Resolver: provides imports
src/module_loader.rs - Mora CLI → Import Resolver: resolves imports
README.md - Mora CLI → Type and Shape Checker: checks program
src/cli.rs - Type and Shape Checker → Diagnostics: reports errors
src/checker.rs - Mora CLI → Tree-Walking Interpreter: runs source
README.md - Tree-Walking Interpreter → Agent and I/O Runtime: dispatches runtime calls
src/interpreter.rs - Tree-Walking Interpreter → Python Bridge: bridges Python calls
src/interpreter.rs - Tree-Walking Interpreter → GGUF Weights and Checkpoints: uses GGUF operations
src/interpreter.rs - Tree-Walking Interpreter → Tensor and Transformer Ops: evaluates tensor ops
src/interpreter.rs - Tree-Walking Interpreter → Reverse-Mode Autograd: dispatches autograd
src/interpreter.rs - Tensor and Transformer Ops → Reverse-Mode Autograd: stores gradient references
src/tensor.rs - GGUF Weights and Checkpoints → Tensor and Transformer Ops: loads tensor data
src/gguf.rs - Mora CLI → Mora IR: lowers compute code
README.md - Mora IR → Arena Memory Planner: plans tensor memory
src/arena_planner.rs - Mora IR → Bytecode VM: executes as bytecode
README.md - Mora CLI → Bytecode VM: selects VM mode
README.md - Mora CLI → Native C99 Generator: selects native mode
README.md - Native C99 Generator → Mora IR: emits from IR
src/codegen_native.rs - Mora CLI → Standalone Bundler: builds standalone binary
README.md - Mora CLI → Language Server: serves language tooling
src/cli.rs - Mora CLI → Source Formatter: formats source
src/cli.rs - Language Server → Type and Shape Checker: checks editor text
src/lsp.rs - Language Server → Import Resolver: resolves editor imports
src/lsp.rs - Source Formatter → Parser and AST: parses for formatting
src/fmt.rs