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§
- Binding
Scope - Typed scope for a phase’s Polydat Kernel compilation.
- Extern
Decl - A typed extern declaration.
- Scoped
Binding - A single binding declaration with provenance.
Enums§
- Binding
Origin - Where a binding was declared — its provenance in the scope chain.
- Scope
Modifier - The modifier on a binding declaration. Mirrors the
BindingModifierflag 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.objectiveis either a bare wire reference (read directly off the phase kernel) or an inline expression;synthesize_phase_scope_bindingslowers the latter tovolatile __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 assynthesize_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.objectivevalue 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 toOBJECTIVE_WIRE. - objective_
wire - The phase-kernel wire the optimizer reads for
objective: the bare name itself, or the synthesizedOBJECTIVE_WIREfor an inline expression. Pairs withsynthesize_phase_scope_bindings, which emits the__objectivebinding for the expression case — the two agree by sharingobjective_is_bare_wire. - resolve_
placeholders_ in_ op_ params - SRD-68 Push 5c — resolve
{name}placeholders in a single op’sparamsagainstkernel. Used by validation wrappers at construction time to pre-resolve config likerelevancy.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_untilnode (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 acounter: u64rather 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.