pub enum Stmt<'a> {
Show 59 variants
Let {
var: Symbol,
ty: Option<&'a TypeExpr<'a>>,
value: &'a Expr<'a>,
mutable: bool,
},
Set {
target: Symbol,
value: &'a Expr<'a>,
},
Call {
function: Symbol,
args: Vec<&'a Expr<'a>>,
},
If {
cond: &'a Expr<'a>,
then_block: &'a [Stmt<'a>],
else_block: Option<&'a [Stmt<'a>]>,
},
While {
cond: &'a Expr<'a>,
body: &'a [Stmt<'a>],
decreasing: Option<&'a Expr<'a>>,
},
Repeat {
pattern: Pattern,
iterable: &'a Expr<'a>,
body: &'a [Stmt<'a>],
},
Return {
value: Option<&'a Expr<'a>>,
},
Break,
Assert {
proposition: &'a LogicExpr<'a>,
},
Trust {
proposition: &'a LogicExpr<'a>,
justification: Symbol,
},
RuntimeAssert {
condition: &'a Expr<'a>,
hard: bool,
},
Give {
object: &'a Expr<'a>,
recipient: &'a Expr<'a>,
},
Show {
object: &'a Expr<'a>,
recipient: &'a Expr<'a>,
},
SetField {
object: &'a Expr<'a>,
field: Symbol,
value: &'a Expr<'a>,
},
StructDef {
name: Symbol,
fields: Vec<(Symbol, Symbol, bool)>,
is_portable: bool,
},
FunctionDef {
name: Symbol,
generics: Vec<Symbol>,
params: Vec<(Symbol, &'a TypeExpr<'a>)>,
body: &'a [Stmt<'a>],
return_type: Option<&'a TypeExpr<'a>>,
is_native: bool,
native_path: Option<Symbol>,
is_exported: bool,
export_target: Option<Symbol>,
opt_flags: OptimizationConfig,
},
Inspect {
target: &'a Expr<'a>,
arms: Vec<MatchArm<'a>>,
has_otherwise: bool,
},
Push {
value: &'a Expr<'a>,
collection: &'a Expr<'a>,
},
Pop {
collection: &'a Expr<'a>,
into: Option<Symbol>,
},
Add {
value: &'a Expr<'a>,
collection: &'a Expr<'a>,
},
Remove {
value: &'a Expr<'a>,
collection: &'a Expr<'a>,
},
SetIndex {
collection: &'a Expr<'a>,
index: &'a Expr<'a>,
value: &'a Expr<'a>,
},
Splice {
body: &'a [Stmt<'a>],
},
Zone {
name: Symbol,
capacity: Option<usize>,
source_file: Option<ZoneSource>,
body: &'a [Stmt<'a>],
},
Concurrent {
tasks: &'a [Stmt<'a>],
},
Parallel {
tasks: &'a [Stmt<'a>],
},
ReadFrom {
var: Symbol,
source: ReadSource<'a>,
},
WriteFile {
content: &'a Expr<'a>,
path: &'a Expr<'a>,
},
Spawn {
agent_type: Symbol,
name: Symbol,
},
SendMessage {
message: &'a Expr<'a>,
destination: &'a Expr<'a>,
compression: Option<CompressionCodec>,
cached: bool,
unchecked: bool,
layout: Option<SendLayout>,
shared: bool,
computed: bool,
indexed: bool,
deduped: bool,
},
AwaitMessage {
source: &'a Expr<'a>,
into: Symbol,
view: bool,
stream: bool,
},
StreamMessage {
values: &'a Expr<'a>,
destination: &'a Expr<'a>,
},
MergeCrdt {
source: &'a Expr<'a>,
target: &'a Expr<'a>,
},
IncreaseCrdt {
object: &'a Expr<'a>,
field: Symbol,
amount: &'a Expr<'a>,
},
DecreaseCrdt {
object: &'a Expr<'a>,
field: Symbol,
amount: &'a Expr<'a>,
},
AppendToSequence {
sequence: &'a Expr<'a>,
value: &'a Expr<'a>,
},
ResolveConflict {
object: &'a Expr<'a>,
field: Symbol,
value: &'a Expr<'a>,
},
Check {
subject: Symbol,
predicate: Symbol,
is_capability: bool,
object: Option<Symbol>,
source_text: String,
span: Span,
},
Listen {
address: &'a Expr<'a>,
secure: Option<SecurePad<'a>>,
},
ConnectTo {
address: &'a Expr<'a>,
secure: Option<SecurePad<'a>>,
},
LetPeerAgent {
var: Symbol,
address: &'a Expr<'a>,
},
Sleep {
milliseconds: &'a Expr<'a>,
},
Sync {
var: Symbol,
topic: &'a Expr<'a>,
},
Mount {
var: Symbol,
path: &'a Expr<'a>,
},
LaunchTask {
function: Symbol,
args: Vec<&'a Expr<'a>>,
},
LaunchTaskWithHandle {
handle: Symbol,
function: Symbol,
args: Vec<&'a Expr<'a>>,
},
CreatePipe {
var: Symbol,
element_type: Symbol,
capacity: Option<u32>,
},
SendPipe {
value: &'a Expr<'a>,
pipe: &'a Expr<'a>,
},
ReceivePipe {
var: Symbol,
pipe: &'a Expr<'a>,
},
TrySendPipe {
value: &'a Expr<'a>,
pipe: &'a Expr<'a>,
result: Option<Symbol>,
},
TryReceivePipe {
var: Symbol,
pipe: &'a Expr<'a>,
},
StopTask {
handle: &'a Expr<'a>,
},
Select {
branches: Vec<SelectBranch<'a>>,
},
Theorem(TheoremBlock<'a>),
Definition(DefinitionBlock<'a>),
Axiom(AxiomBlock),
Theory(TheoryBlock),
Escape {
language: Symbol,
code: Symbol,
span: Span,
},
Require {
crate_name: Symbol,
version: Symbol,
features: Vec<Symbol>,
span: Span,
},
}Variants§
Let
Variable binding: Let x be 5. or Let x: Int be 5.
Set
Mutation: Set x to 10.
Call
Function call as statement: Call process with data.
If
Conditional: If condition: ... Otherwise: ...
While
Loop: While condition: ... or While condition (decreasing expr): ...
Fields
Repeat
Iteration: Repeat for x in list: ... or Repeat for i from 1 to 10: ...
Return
Return: Return x. or Return.
Break
Break: Break. — exits the innermost while loop.
Assert
Bridge to Logic Kernel: Assert that P.
Trust
Documented assertion with justification.
Trust that P because "reason".
Semantics: Documented runtime check that could be verified statically.
RuntimeAssert
Runtime assertion with imperative condition.
Assert that condition. (hard: false → debug_assert!, a development check)
Require that condition. (hard: true → assert!, an enforced invariant that
survives release — the form a proven property lowers to).
Give
Ownership transfer (move): Give x to processor.
Semantics: Move ownership of object to recipient.
Show
Immutable borrow: Show x to console.
Semantics: Immutable borrow of object passed to recipient.
SetField
Field mutation: Set p's x to 10.
StructDef
Struct definition for codegen.
FunctionDef
Function definition.
Fields
generics: Vec<Symbol>Generic type parameters: empty for monomorphic functions, e.g. [T, U] for polymorphic.
native_path: Option<Symbol>Rust path for user-defined native functions (e.g., “reqwest::blocking::get”). None for system native functions (read, write, etc.) which use map_native_function().
export_target: Option<Symbol>Export target: None = C ABI (#[no_mangle] extern “C”), Some(“wasm”) = #[wasm_bindgen].
opt_flags: OptimizationConfigPer-function optimization config: each ## No <X> annotation clears
that optimization’s bit (default: all enabled).
Inspect
Pattern matching on sum types.
Push
Push to collection: Push x to items.
Pop
Pop from collection: Pop from items. or Pop from items into y.
Add
Add to set: Add x to set.
Remove
Remove from set: Remove x from set.
SetIndex
Index assignment: Set item N of X to Y.
Splice
A SCOPE-TRANSPARENT statement sequence — parser-desugar output, never
written by users. One surface statement can lower to several primitive
statements (a nested place-write Set item j of (item i of grid) to v
becomes read → copy-on-write element write → write-back; a multi-push
Push a, b, c to xs becomes one Push per element). The body runs in
the ENCLOSING scope with no block of its own: temporaries inside are
gensym’d (__place_*), so they can never collide with user names, and
engines that execute blocks with scoping must NOT scope this one.
Zone
Memory arena block (Zone). “Inside a new zone called ‘Scratch’:” “Inside a zone called ‘Buffer’ of size 1 MB:” “Inside a zone called ‘Data’ mapped from ‘file.bin’:”
Fields
source_file: Option<ZoneSource>Optional backing file for memory-mapped zones (literal path or runtime variable)
Concurrent
Concurrent execution block (async, I/O-bound). “Attempt all of the following:” Semantics: All tasks run concurrently via tokio::join! Best for: network requests, file I/O, waiting operations
Parallel
Parallel execution block (CPU-bound). “Simultaneously:” Semantics: True parallelism via rayon::join or thread::spawn Best for: computation, data processing, number crunching
ReadFrom
Read from console or file.
Read input from the console. or Read data from file "path.txt".
WriteFile
Write to file.
Write "content" to file "output.txt".
Spawn
Spawn an agent.
Spawn a Worker called "w1".
SendMessage
Send message to agent.
Send Ping to "agent"., Send compressed Ping to "agent".,
Send cached Point to "agent"., or Send cached compressed Report to "agent".
Fields
compression: Option<CompressionCodec>The wire compression codec. None for a plain Send; Some(codec) for
Send compressed [with <codec>] (bare compressed = deflate). Kept only
if it actually shrinks the body.
cached: boolSend cached … — use the connection’s schema dictionary, so a struct
schema is transmitted once and referenced thereafter (content-addressed,
footgun-free). false for a plain Send.
unchecked: boolSend unchecked … — drop the wire integrity checksum for the fastest path
(latency↔safety dial). false keeps the default checksum.
layout: Option<SendLayout>Send fast|compact|packed … — the wire LAYOUT (size↔speed dial). None is
the default (compact / varint). The sender picks for their link.
Send shared … — OPT-IN type-id elision: drop struct/enum NAMES off the wire
(ship a small registry id both ends derive from their shared program type
defs). Only safe when the receiver runs the same program, so it is OFF by
default — the default Send stays self-describing for any peer / relay.
computed: boolSend computed f … — COMPUTE-SHIPPING: when the message is a pure single-arg
function, lower it to a sandboxed generator and ship the COMPUTATION, not data.
The receiver evaluates it in the bounded sandbox (never arbitrary code). OFF by
default; a non-lowerable function under computed is rejected at send.
indexed: boolSend indexed … (alias addressable) — encode a record list in the random-access
struct-view LAYOUT (row + field offset tables), so the receiver reaches any
(row, field) in O(1) without decoding the rest — Cap’n Proto’s home turf. Composes
with the other knobs (compressed, cached, shared, unchecked). OFF by default
(the dense columnar form is smaller); opt in when the peer does random field reads.
deduped: boolSend deduped … — Rc-DEDUP: a subtree the same value reaches more than once ships ONCE
(the first occurrence) plus a tiny backref for every repeat, and the receiver rebuilds the
SHARING (one aliased value, not N copies). OFF by default; opt in when the message has
shared sub-structure (a lookup table referenced by many records, one object aliased
across the payload). Self-describing by tag, so any peer decodes it.
AwaitMessage
Await response from agent.
Await response from "agent" into result.
Fields
StreamMessage
Stream a batch of values to a peer in one framed message.
Stream readings to "sink". — frames each element of values length-delimited so the
receiver (Await stream from …) deframes them incrementally; one relay publish ships the
whole batch (Kafka-style streaming that amortizes per-message overhead).
MergeCrdt
Merge CRDT state.
Merge remote into local. or Merge remote's field into local's field.
IncreaseCrdt
Increment GCounter.
Increase local's points by 10.
DecreaseCrdt
Decrement PNCounter (Tally).
Decrease game's score by 5.
AppendToSequence
Append to SharedSequence (RGA).
Append "Hello" to doc's lines.
ResolveConflict
Resolve MVRegister conflicts.
Resolve page's title to "Final".
Check
Security check - mandatory runtime guard.
Check that user is admin.
Check that user can publish the document.
Semantics: NEVER optimized out. Panics if condition is false.
Fields
Listen
Listen on network address.
Listen on "/ip4/127.0.0.1/tcp/8000".
Semantics: Bind to address, start accepting connections via libp2p
Fields
ConnectTo
Connect to remote peer.
Connect to "/ip4/127.0.0.1/tcp/8000".
Semantics: Dial peer via libp2p
Fields
LetPeerAgent
Create PeerAgent remote handle.
Let remote be a PeerAgent at "/ip4/127.0.0.1/tcp/8000".
Semantics: Create handle for remote agent communication
Sleep
Sleep for milliseconds.
Sleep 1000. or Sleep delay.
Semantics: Pause execution for N milliseconds (async)
Sync
Sync CRDT variable on topic.
Sync x on "topic".
Semantics: Subscribe to GossipSub topic, auto-publish on mutation, auto-merge on receive
Mount
Mount persistent CRDT from journal file.
Mount counter at "data/counter.journal".
Semantics: Load or create journal, replay operations to reconstruct state
Fields
LaunchTask
Launch a fire-and-forget task (green thread).
Launch a task to process(data).
Semantics: tokio::spawn with no handle capture
LaunchTaskWithHandle
Launch a task with handle for control.
Let worker be Launch a task to process(data).
Semantics: tokio::spawn returning JoinHandle
Fields
CreatePipe
Create a bounded channel (pipe).
Let jobs be a new Pipe of Int.
Semantics: tokio::sync::mpsc::channel(32)
Fields
SendPipe
Blocking send into pipe.
Send value into pipe.
Semantics: pipe_tx.send(value).await
ReceivePipe
Blocking receive from pipe.
Receive x from pipe.
Semantics: let x = pipe_rx.recv().await
TrySendPipe
Non-blocking send (try).
Try to send value into pipe.
Semantics: pipe_tx.try_send(value) - returns immediately
Fields
TryReceivePipe
Non-blocking receive (try).
Try to receive x from pipe.
Semantics: pipe_rx.try_recv() - returns Option
Fields
StopTask
Cancel a spawned task.
Stop worker.
Semantics: handle.abort()
Select
Select on multiple channels/timeouts.
Await the first of:
Receive x from ch:
...
After 5 seconds:
...
Semantics: tokio::select! with auto-cancel
Fields
branches: Vec<SelectBranch<'a>>The branches to select from
Theorem(TheoremBlock<'a>)
Theorem block.
## Theorem: Name
Given: Premise.
Prove: Goal.
Proof: Auto.
Definition(DefinitionBlock<'a>)
## Define block — a vernacular-logic predicate definition (Rung 0a).
x is a bachelor if and only if x is unmarried and x is a man.
Non-executable: like Stmt::Theorem, it is a declaration the proof
layer consumes, not code the VM/AOT runs.
Axiom(AxiomBlock)
## Axiom block — a named first-order axiom in formal notation. Registers a
shared premise for later theorems (the seam for an axiomatic base like Tarski).
Theory(TheoryBlock)
## Theory block — a named development grouping formal axioms and theorems.
Escape
Escape hatch: embed raw foreign code.
Escape to Rust: followed by an indented block of raw code.
Variables from the enclosing LOGOS scope are available in the
escape block as their generated Rust types. The raw code is
emitted verbatim inside a { ... } block in the generated Rust.
Fields
Require
Dependency declaration from ## Requires block.
The “serde” crate version “1.0” with features “derive”.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Stmt<'a>
impl<'a> RefUnwindSafe for Stmt<'a>
impl<'a> Send for Stmt<'a>
impl<'a> Sync for Stmt<'a>
impl<'a> Unpin for Stmt<'a>
impl<'a> UnsafeUnpin for Stmt<'a>
impl<'a> UnwindSafe for Stmt<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.