Skip to content

Architecture

Andrew Matthews edited this page Aug 14, 2025 · 1 revision

Architecture

A high-level view of the current compiler pipeline and components.

Pipeline overview

flowchart LR
    A[Source .5th] --> B[Lexer/Parser (ANTLR)]
    B --> C[AST Builder (Visitor)]
    C --> D[Language Analysis Phases]
    D --> E[Type Annotation & Checks]
    E --> F[IL Code Generator]
    F --> G[.il file + validation]
Loading

Key components

  • Parser (src/parser)
    • ANTLR grammar + generated lexer/parser
  • AST Model/Generated (src/ast-model, src/ast-generated)
    • Node types and builder-generated code
  • Compiler (src/compiler)
    • Orchestration of parsing and phases
    • Language analysis passes
  • Code Generator (src/code_generator)
    • Emits .NET IL, validates structure
  • Tests (test/ast-tests)
    • Parser/AST visitors
    • Type annotation
    • End-to-end IL generation

Data flow

  1. Source code is tokenized and parsed
  2. AST Builder produces a typed AST structure
  3. Analysis phases annotate types, resolve references, check constraints
  4. Code generator converts the processed AST to .NET IL
  5. Tests verify each stage and the final IL output

Notes

  • Primitive types map to IL primitives; user types map to .NET constructs
  • The pipeline is evolving; phases and responsibilities may shift as the language grows

Clone this wiki locally