15.2 Mod SDK
compiler-sdk package, Beskid.Syntax mirror, Collector contract hierarchy, query pipeline.
Mod SDK
The compiler-sdk package is the Beskid-side API for mods—contracts and Beskid.Syntax operations, not string templates.
Full normative article: Compiler Mod SDK.
Contract hierarchy
Section titled “Contract hierarchy”| Contract | Role |
|---|---|
Collector | Declarative target collection and scope narrowing |
Generator | Typed AST contributions (incremental by default) |
Analyzer | Diagnostics + rewrite fixes on merged program |
Rewriter<TSource, TTarget> | Result<TTarget, FixError> Rewrite(...) |
AttributeGenerator | Exported attributes (e.g. serialization mods) |
Beskid.Syntax
Section titled “Beskid.Syntax”Nodeis a contract; traversal usesNodeRef{ syntaxGenerationId, nodeId }Beskid.Compiler.Query+ fluent DSL (Select,WhereKind,Replace, …)- No source text emission—hosts merge typed trees, then re-parse under bounds
Generated mirrors come from beskid_ast_reflect_gen—Rust AST is canonical; SDK sources are not hand-duplicated parallel syntax.
Rust host areas
Section titled “Rust host areas”Implementation specs under Compiler mods: