Skip to main content

compile_module_framed

Function compile_module_framed 

Source
pub fn compile_module_framed(
    src: &str,
    frame: &[Text],
) -> Result<Rc<ModuleData>, Error>
Expand description

Compile Elly module source against a frame: an ordered list of names the module is instantiated against — a host prelude, module-minted identities. A body’s reference to one resolves to a de Bruijn local whose index walks past the module terminal into the frame, so it costs one indexed lookup and nothing is evaluated on access.

A name in a body is looked for in the enclosing &/let binders, then the module’s imports, then its own items, then frame; a name in none of them is ParseError::UnboundName. The module’s imports take the leading frame slots, so the returned ModuleData’s frame_names is its imports followed by frame, and instantiate wants the import instances ahead of the values for frame. ModuleData::imports says how many lead and what they were imported from; load_module is what fills them.

compile_module is this with an empty frame.