etdl-compiler
The ETDL compiler pipeline — semantic validation, IEC 61025 fault-tree probability resolution, ECEL type-checking, and the target-agnostic CodeGenerator trait (plus the built-in rust target) that turns a validated .etdl document into generated code.
Pipeline
validate::validate_document— structural and semantic diagnostics: E-1xx document structure, V-1xx info integrity, V-2xx type checking/probability ranges/branch sums, V-3xx event-tree topology, V-4xx fault-tree correctness (gate arity, cycles), V-5xx codegen preconditions, W-4xx warnings.fault_tree::resolve_fault_trees— exact top-event probability evaluation (AND/OR/NOT/XOR/K-of-N gates, exponential failure model, MOCUS minimal cut sets) — a fault tree's failure probability becomes a build-time-computed constant, not a runtime guess.typeck— ECEL condition type-checking against resolved AsyncAPI message schemas.codegen::CodeGenerator— the pluggable target trait every code-generation backend implements (see below).
The target trait
Every target consumes the same validated document + resolved fault-tree probabilities computed once, here — no target re-parses .etdl, re-validates ECEL conditions, or re-evaluates fault trees. This crate ships RustCodeGenerator (the rust target: async fn handle_<event> functions built on etdl-core); etdl-target-java, etdl-target-python, etdl-target-go, and etdl-target-dotnet implement the same trait as separate, optional crates.
Reliability
The reliability Cargo feature (default-on) wires in etdl-reliability-core, the small, deterministic, WASM-compatible reliability layer this compiler depends on directly. Richer reliability engineering (statistical estimation, Bayesian analysis, evidence, ontology, failure discovery) lives in separate optional crates this compiler does not depend on — see etdl-reliability.
Example
use Compiler;
use ;
use Path;
let base = new;
let doc = parse_document_from_file?;
let registry = load_asyncapi_imports?;
let result = new.compile;
assert!;
assert!;
# Ok::
Full architecture (pipeline, codegen contract, target registry): docs/architecture.md and docs/architecture/targets.md.
License
Apache-2.0