How lamina-dev/lamina works
Lamina is a statically typed, expression-oriented mathematical language with a compiler front end, register-based virtual machine, mathematical bridge, and C ABI. Its main workflow takes source text through lexing, parsing, type checking, MIR generation, and bytecode assembly before VM execution. The README documents that pipeline and the mathematical standard-library capabilities; sampled excerpts also show VM instruction handling and sparse-matrix bridge operations. Some mathematical subsystems are represented by their exact enclosing directories because their implementation files were not sampled.
Main entry points: conversions.hpp Math bridge · vm.cpp Virtual machine · lmx.cpp C ABI · compiler.hpp Compiler pipeline
Components 29
Compiler frontend
- Lexer
compiler/lexer.cpp - Parser
compiler/parser.cpp - AST and types
compiler/ast/ast.hpp - Type checker
compiler/hir/type_checker.cpp - MIR builder
compiler/mir/mir_builder.cpp - Assembler
compiler/assembler.cpp - Compiler pipeline
compiler/compiler.hpp
Bytecode runtime
- Code modules
runtime/object/code_module.cpp - Virtual machine
runtime/vm.cpp - Runtime values
runtime/object/value.hpp - Runtime objects
runtime/object/object.hpp - Strings
runtime/object/StringObj.hpp - Arrays
runtime/object/array.hpp - Algebraic data
runtime/object/adt.hpp - Fractions
runtime/object/fraction.hpp - Expr values
runtime/object/expr_obj.hpp - Matrices
runtime/object/matrix.hpp
Math capabilities
- Math bridge
bridge/conversions.hpp - Math results
bridge/result.hpp - Symbolic CAS
bridge/cas - Linear algebra
bridge - Statistics
bridge/stats.cpp - Random numbers
bridge/random_numbers.cpp - Units
bridge/units.cpp - Sparse matrices
bridge/sparse_linear_algebra_storage.cpp
Interfaces and values
- CLI
main.cpp - C ABI
lmx.cpp - Public C headers
include/lmx.h
Other components
- Language user
Connections 28
- Language user → CLI: runs source
- CLI → Compiler pipeline: starts compilation
- C ABI → Compiler pipeline: compiles source
lmx.cpp - Compiler pipeline → Lexer: lexes
- Lexer → Parser: produces tokens
- Parser → AST and types: builds AST
- AST and types → Type checker: checks types
- Type checker → MIR builder: builds HIR
- MIR builder → Assembler: lowers MIR
- Assembler → Code modules: assembles bytecode
- Code modules → Virtual machine: runs module
- C ABI → Virtual machine: runs module
- Virtual machine → Runtime values: executes with
runtime/vm.cpp - Runtime values → Runtime objects: holds references
runtime/object/value.hpp - Virtual machine → Algebraic data: constructs and matches
runtime/vm.cpp - Virtual machine → Arrays: executes container operations
runtime/vm.cpp - Virtual machine → Fractions: uses arithmetic
runtime/vm.cpp - Virtual machine → Math bridge: calls math bindings
- Math bridge → Math results: converts results
bridge/result.hpp - Math bridge → Expr values: converts expressions
bridge/conversions.hpp - Math bridge → Matrices: converts matrices
bridge/conversions.hpp - Math bridge → Symbolic CAS: exposes symbolic APIs
bridge/cas/expr.cpp - Math bridge → Linear algebra: exposes linear algebra
bridge/conversions.hpp - Math bridge → Statistics: exposes statistics
- Math bridge → Random numbers: exposes random APIs
- Math bridge → Units: exposes unit APIs
- Math bridge → Sparse matrices: implements sparse operations
bridge/sparse_linear_algebra_storage.cpp - C ABI → Public C headers: implements public ABI
lmx.cpp