Skip to main content

Module scope

Module scope 

Source
Expand description

Typed binding scope model for Polydat Kernel compilation.

A BindingScope is the structured intermediate representation that replaces raw string manipulation for scope composition. Every binding carries its provenance (BindingOrigin), its modifier, and its definition text. Scope rules are checked against this typed structure, and a single deduplicated GK source string is emitted at the end.

Structs§

BindingScope
Typed scope for a phase’s Polydat Kernel compilation.
ExternDecl
A typed extern declaration.
ScopedBinding
A single binding declaration with provenance.

Enums§

BindingOrigin
Where a binding was declared — its provenance in the scope chain.
ScopeModifier
The modifier on a binding declaration. Mirrors the BindingModifier flag set in polydat’ Polydat AST plus the binding-kind keywords (init, cursor) that nmbrs-runtime’s text-level scope assembly cares about.

Constants§

OBJECTIVE_WIRE
The phase-kernel wire an inline objective expression is lowered to (SRD-86). optimize.objective is either a bare wire reference (read directly off the phase kernel) or an inline expression; synthesize_phase_scope_bindings lowers the latter to volatile __objective := <expr> so the optimizer reads exactly one wire regardless of which form the author wrote. The __ prefix keeps it from colliding with author-declared outputs (same convention as synthesize_metric_binding_name).

Functions§

build_do_loop_scope_kernel
build_op_template_scope_kernel
SRD-13d Phase 9 — synthesize a per-op-template kernel for a materialised op-template scope.
build_phase_scope_kernel
Synthesize a phase-scope kernel.
build_scope
objective_is_bare_wire
Whether an optimize.objective value is a bare wire reference — a single identifier read directly off the phase kernel — versus an inline expression (operators, calls, dots, whitespace) that must be synthesized. A bare reference is left untouched (no synthesis, current behavior); an expression is lowered to OBJECTIVE_WIRE.
objective_wire
The phase-kernel wire the optimizer reads for objective: the bare name itself, or the synthesized OBJECTIVE_WIRE for an inline expression. Pairs with synthesize_phase_scope_bindings, which emits the __objective binding for the expression case — the two agree by sharing objective_is_bare_wire.
resolve_placeholders_in_op_params
SRD-68 Push 5c — resolve {name} placeholders in a single op’s params against kernel. Used by validation wrappers at construction time to pre-resolve config like relevancy.k = "{k}" against their dispenser’s canonical kernel, so the downstream spec parsers see a literal value (10) rather than a surviving placeholder string.
rewrite_inline_exprs
Rewrite inline expressions ({{expr}}) in op template strings to use named binding references ({__expr_N}).
synthesize_cell_binding_name
The kernel wire a metric’s cell COORDINATE is lowered to, per (metric, dimension).
synthesize_metric_binding_name
synthesize_phase_scope_bindings
Build the per-scope Polydat Kernel for a do_while / do_until node (SRD 18b). Same composition contract as for_each (every name visible at this scope resolves through standard Polydat API on the synthesized kernel) — the difference is the “scope output” is a counter: u64 rather than tuple iteration variables, and there’s no value list to pre-eval.
validate_placeholders_via_kernel
Apply iteration-variable substitution to op-template strings only — raw:, prepared:, stmt:, etc.