etdl-parser
The .etdl document parser for ETDL (Event Tree Definition Language) — turns a YAML .etdl document into a typed AST, parses ECEL (Event-tree Condition Expression Language) barrier-branch conditions, and resolves AsyncAPI 3.0 message/channel references.
What it does
- Document parsing:
serde-based deserialization of the ETDL document schema (event trees per IEC 62502, fault trees per IEC 61025) intoast::EtlDocument, with a manualDeserializenormalizing legacy field names and preservingx-*extension fields. - ECEL parsing: a small
nom-based parser for barrier-branch conditions — comparisons,in(set membership),matches(RE2-compatible regex), wildcard array quantification — producingecel::Condition. - AsyncAPI 3.0 resolution: loads
asyncapi_importsdocuments and resolves both External References (alias#/components/messages/Foo) and Internal References (#/components/messages/Foo) via RFC 6901 JSON Pointer, normalizing both into the same{name, payload, headers}envelope shape so downstream code doesn't need to branch on which kind of reference it's looking at.
Where this sits
.etdl document + AsyncAPI 3.0 imports
|
v
etdl-parser <- this crate: parse, don't validate semantics
|
v
etdl-compiler (structural/semantic validation, fault-tree
| resolution, ECEL type-checking, code generation)
v
etdl-cli / etdl-wasm / language targets
This crate deliberately stops at syntax and structure — it does not check that a referenced handler exists, that probabilities sum to 1.0, or that an ECEL condition type-checks against a message schema. That's etdl-compiler's job, one layer up, so every consumer (CLI, WASM bindings, every language target) shares one parser and one semantic-validation pipeline instead of each re-deriving it.
Example
use ;
use Path;
let base = new;
let doc = parse_document_from_file?;
let registry = load_asyncapi_imports?;
# Ok::
Full ETDL architecture and pipeline: docs/architecture.md.
License
Apache-2.0