Skip to main content

Architecture Overview

mType compiles source to a stack-based bytecode VM with an optional x86-64 JIT. The repo is organized as a few well-defined layers:

.mt source

Lexer / Parser → AST → Optimizer → Bytecode Compiler → .mtc

VM ──→ JIT (AsmJit)

Top-level Components

ComponentPathResponsibility
LexermType/lexer/Tokenization, source-location tracking, bracket balancing.
ParsermType/parser/Builds the AST. Sub-parsers per construct (class, interface, expression, statement, lambda, type).
ASTmType/ast/Node types for every construct, plus the visitor scaffolding.
OptimizermType/optimizer/Pluggable AST passes — constant folding, dead code elimination, unused decl elimination.
Bytecode CompilermType/vm/compiler/AST → stack-based bytecode + class metadata.
VMmType/vm/runtime/Stack-based execution engine with specialized instruction executors.
JITmType/vm/jit/AsmJit-backed x86-64 compilation of hot paths (scaffolding present).
Type RegistrymType/types/Declared types, generic parameters, conversion rules.
Runtime TypesmType/runtimeTypes/Class, function, and global definitions used at runtime.
ServicesmType/services/File reading, import management, top-level script driver.
Plugin LoadermType/plugin/Runtime loader for native .dll/.so/.dylib plugins via a stable C ABI. See Native Interop → Runtime Native Plugins.

Detailed Pages