Skip to main content

Module body

Module body 

Source
Expand description

Process and event bodies, resolved, and their variables: Bodies, which rast::build returns beside the declarations and typing consumes.

Each body owns one table of its variables, BodyVars indexed by BodyVarId: a process’s parameters, x: T; declarations and receive binders (its proc vars); an event’s carriers and declarations (its evt vars). A use refers to its entry, so a backend allocates one slot per entry, and two variables of one name in different scopes are two entries.

§Scopes

A body’s names are looked up in its frames, innermost first, then the program’s locals, then the system’s consts. Event and process scopes are disjoint: a process value reaches an event only through a carrier.

  • A process’s parameters are in scope for its whole body; a x: T; from there to the end of its sequence; a receive binder c?x for the prefix’s continuation only, so it is gone at the ;.
  • Each branch of a choice starts from the same frames: a sibling’s binder is invisible.
  • A reference P(args) resolves its arguments where it is written and does not enter P: a binder reaches a helper only as an argument.
  • An event’s carriers are in scope for its whole body and read-only; its x: T; from there to the end.

Redeclaring a name of the same body that is still in scope is an error; shadowing a local, a mapping or a system const is a warning.

Structs§

Body
A program’s code: its events and processes, each its signature beside its body, and its entry points.
BodyVar
A variable of one body.
EventBody
An event: its signature, variables and statements.
ProcBody
A process: its signature, variables and term.

Enums§

Comm
A channel event.
Event
The event a prefix fires.
Proc
A process term.
Stmt
An event statement.

Type Aliases§

Bodies
Every body of a project: one Body per program, by the program’s id.