pub enum Statement {
InputDecl(InputDecl),
Binding(Binding),
ModuleDef(ModuleDef),
ExternPort(ExternPort),
Cursor(CursorDecl),
Pragma {
name: String,
span: Span,
},
}Expand description
A top-level statement.
Variants§
InputDecl(InputDecl)
input name[: type] — declares one per-cycle kernel input slot.
The name becomes both an input slot (settable via set_input)
and a passthrough output (readable via get_constant/pull).
Surface forms (parser desugars the tuple into N InputDecls,
mirroring the module-signature param-list shape from
a host-provided cycle module):
input cycle: u64
input (cycle: u64, q: f64)Binding(Binding)
A name-to-expression binding. The modifier on the binding determines its lifecycle:
- no modifier — per-cycle: re-evaluated every cycle.
const— effectively-const for the scope’s lifetime: materialized at the earliest opportunity (compile-time fold if the RHS is fold-eligible, otherwise scope-init pull after materialize-wiring has populated extern slots). Authors don’t need to know which path the runtime takes — the contract is “fixed once, then immutable.”shared— cell-backed, mutable across kernel instances in the same lineage. See SRD-16 §“Mutability Rules: Shared Mutable”.volatile— per-cycle, excluded fromhash_const. See SRD-44.
Surface forms:
x := mul(cycle, 2) // per-cycle
const pi := 3.14 // const, folds at compile
const ann_opts := str_concat(...) // const, materializes at scope-init
shared budget := 100 // shared cell
(a, b) := split_pair(...) // tuple destructuringModuleDef(ModuleDef)
name(param: type, ...) -> (output: type, ...) := { body }
ExternPort(ExternPort)
extern name: type = default
Cursor(CursorDecl)
cursor name = Cursor() or cursor name = constructor_expr
Pragma
pragma <name> — a module-level directive opting into a
compile-time graph transform (SRD 15 §“Module-Level
Pragmas”). First-class grammar, distinct from line
comments. Recognised pragmas trigger
CompileEvent::PragmaAcknowledged; unknown names trigger
CompileEvent::UnknownPragma and are otherwise ignored
(forward-compatible).