07 — Compiler Architecture

Transform Phase


The Transform phase operates on the AST produced by Parse. It resolves all token reference chains, validates composition graphs, evaluates state machine declarations, applies constraint assertions, and performs semantic analysis. Transform is where most conformance validation occurs. Transform errors are the primary mechanism by which IDL enforces the rules declared in Foundation, Visual Doctrine, the Language System, the Token System, and the Component System.

Built-in Transform Operations

OperationDescriptionError Type
Token chain resolutionResolves all alias chains to concrete values; validates three-hop maximum.Error
Tier reference validationValidates that token references only reference permitted tiers.Error
Slot graph analysisBuilds slot graph and validates acyclicity.Error
State machine validationValidates that all transition targets are declared states.Error
Composition rule evaluationValidates composition constraints against the slot graph.Error
Density resolutionResolves spatial token values for the target density level.Warning (unsupported density)
Theme completenessValidates that alternate themes cover all semantic token names.Error

Transform Phase Order

Built-in transforms run in a defined order. Plugin transforms run after all built-in transforms are complete. The order of built-in transforms is: import resolution → token chain resolution → tier reference validation → slot graph analysis → state machine validation → composition rule evaluation → density resolution → theme validation. This order ensures that each transform operates on a partially-validated AST and can rely on the results of preceding transforms.