The compiler uses a multi-pass architecture:
- Lexical Analysis (Lexer): Transforms source text into a stream of tokens.
- Parsing (Parser): Consumes tokens to build an Abstract Syntax Tree (AST).
- Semantic Analysis (TypeChecker): Validates scope, variable declarations, and (in future) types.
- Intermediate Representation (IR): Translates AST into a flattened SSA-inspired 3-address code format.
- Optimization: Performs passes on IR (Constant Folding, Dead Code Elimination).
- Code Generation / Execution (VM): The VM executes the IR instructions directly (or bytecode in future).
core/lexer: Tokenizercore/parser: Recursive descent parsercore/semantic: Symbol table and semantic checkscore/ir: IR definitions (Opcodes, Blocks, Modules)core/optimizer: IR-to-IR transformation passescore/vm: Stack/Register hybrid execution engine