07 — Compiler Architecture
Plugin Interface
Plugins may extend the compiler at three defined extension points: after Parse (read-only AST access), after Transform (read-write AST access for producing additional transformed nodes), and during Emit (registering custom emitters for specific AST node types). Plugins MUST NOT modify core phase behavior — they extend the pipeline, not replace it.
Extension Points
| Extension Point | AST Access | Permitted Operations |
|---|---|---|
| after-parse | Read-only | Inspect AST, produce metadata, register custom validation rules for Transform. |
| after-transform | Read-write | Add new AST nodes, annotate existing nodes, produce additional metadata. |
| during-emit | Read-only | Register emitters for specific AST node types, produce output artifacts. |
Plugin Declaration
Plugins are declared in the IDL configuration file. Each plugin declaration specifies the plugin package identifier, the extension points it registers for, the AST schema version it requires, and any configuration options. The compiler validates plugin compatibility against the current AST schema version before initializing the plugin. Incompatible plugins produce a startup error, not a per-file error.
Plugin API Versioning
Plugin APIs are versioned independently from the core compiler version. A plugin that requires Plugin API v2 will not execute under a compiler that provides Plugin API v1. Major Plugin API versions may introduce breaking changes to the plugin interface; minor versions are additive. The current plugin API version is declared in the compiler package metadata.