Skip to main content

Module factory

Module factory 

Source
Expand description

External-facing factory module. Made pub (was pub(crate)) so crates that host polydat nodes outside the polydat crate (host runtimes) can reach ConstArg, compile_ctx, and build_node from their register_nodes! invocations. Node factory: maps Polydat function names to runtime node instances.

build_node is the single dispatch point used by the compiler’s compile_binding to turn a parsed call expression into a Box<dyn PolydatNode>. ConstArg captures assembly-time constant arguments extracted from the AST.

Dispatch is decentralized: each node module exposes its own build_node function returning Option<Result<...>>. The top-level build_node here tries each module in turn and falls back to the registry for variadic nodes.

Modules§

compile_ctx
Source-binding attribution, set by the compiler before each build_node call and read by factories that want to record which DSL binding caused the node to exist. The control_set factory is the canonical consumer: rate_adj := control_set("rate", target) calls the factory with current_binding() returning "rate_adj", which the node stores for runtime attribution in ControlOrigin::Polydat { binding }.

Enums§

ConstArg
Constant arguments extracted from the AST.

Functions§

build_node
Build the node func takes for the given wires, their types, and constant arguments, through the registry; an unknown function or a mismatched signature is an error naming it.