SPB Git

spb/air Public MIT

AIR — The Language of Accounting.

Python 100%
1.0 KB · 30 lines python
Raw Blame History
1# =============================================================================2# Projet : AIR — Accounting Intermediate Representation3# Auteur : Simon-Pierre Boucher4# Contact : contact@spboucher.ai5# Fichier : base.py6# Description : Pass interface — every AIC transformation implements this.7# =============================================================================8"""Base class for AIC passes (LLVM-pass analogue).910A pass is a deterministic transformation over the CompilationUnit. It returns11diagnostics; it never calls an LLM, the network, or a clock. The pass manager12re-verifies the double-entry invariant after every pass.13"""14from __future__ import annotations1516import abc1718from aic.diagnostics import Diagnostic19from aic.unit import CompilationUnit202122class Pass(abc.ABC):23    """One deterministic compilation step."""2425    name: str = "pass"2627    @abc.abstractmethod28    def run(self, unit: CompilationUnit) -> list[Diagnostic]:29        """Transform the unit in place; return any diagnostics produced."""30