Skip to main content

Module rast

Module rast 

Source
Expand description

rast, the resolved AST: the program as written, with every name an id.

Every reference names the node it denotes: a channel its endpoint PDs, a mapping its region, a call its foreign function, a variable its declaration. Duplicates are rejected, and the vaddrs allocated once every program is resolved. Types stay as written (TypeRef), and constants unevaluated.

rast defines a node only where resolution changes its content and typing changes it again (one typing leaves as resolved is base’s); a declaration that names nothing (a memory region, a protection domain) is the AST’s own node, cloned into its arena. rast owns all its data, so the AST can be dropped once it is built.

Re-exports§

pub use body::Bodies;
pub use body::Body;
pub use body::BodyVar;
pub use body::Comm;
pub use body::Event;
pub use body::EventBody;
pub use body::Proc;
pub use body::ProcBody;
pub use body::Stmt;
pub use env::build;
pub use env::build_data;
pub use env::build_programs;
pub use env::build_system;
pub use env::lay_out;
pub use env::Channel;
pub use env::Const;
pub use env::Env;
pub use env::Field;
pub use env::ForeignFn;
pub use env::LocalVar;
pub use env::LocalVars;
pub use env::Rast;
pub use env::Struct;
pub use expr::Expr;
pub use expr::ExprKind;

Modules§

body
Process and event bodies, resolved, and their variables: Bodies, which rast::build returns beside the declarations and typing consumes.
env
The resolved AST, Rast, and its environment, Env: the declarations resolution builds and typing changes again (Channel, Struct and its Fields, Const, LocalVar), and build, which builds them from a checked AST. What typing leaves as resolved is base’s.
expr
Expressions, resolved: a variable is the declaration it denotes, a call the foreign function it reaches, m.vaddr and m.paddr the mapping.
program
Resolving one .fi program: its imports (each alias to the file the store read, in scope while its bodies are resolved), mappings (into Env::mappings), locals, events, processes and entry points, each in its own arena. A called foreign function joins Env::ffis at its first call, its signature lowered to fic’s types, and the store records where it is.
scope
What a name in a body denotes: the body’s frames, innermost first, then the program’s locals, then the system’s consts (BodyScope); and the program’s and system’s declarations a body can name (Outer). The scope rules themselves are body.rs’s walk.
system
Resolving the .fis declarations: channels, structs, consts and the System = composition, into the Env. Memory regions and protection domains name nothing, so Env holds the AST’s own nodes for them.