Module core

Module core 

Source
Expand description

Core data types: expressions (Exp), values (Val), and environments (Env).

The floor language is λ↑↓ as defined by base.scm in namin/pink (Amin & Rompf, Collapsing Towers of Interpreters, POPL 2018): a unary lambda calculus with pairs, staging operators, and a small set of effects. The representation is nameless — the parser resolves every identifier to an environment slot, so variables are Exp::Var indices and binders carry no names. This module holds only the data: the CK machine that evaluates it lives in crate::eval, the reader in crate::parse.

Enums§

Exp
A floor expression, after parsing and sugar expansion.
Val
A runtime value.

Functions§

code
Wrap an expression tree as a Val::Code staged-code value.
count_nodes
Count Exp tree nodes — used by Val::Display for #<code N nodes>, and by tests that need to bound compiled-ANF size.
env_new
An empty environment.
env_push
Push a value onto a borrowed environment, returning a new Env.
env_push_owned
Push a value onto an owned environment, returning a new Env.
rc_exp
Wrap an expression as a shared child node.
rc_val
Wrap a value as a shared child node.
tup
Cons two values into a Val::Tup pair.

Type Aliases§

Env
A persistent, copy-on-write environment: Rc<Vec<Val>>.
RcExp
Shared expression node. See the note above on why Rc and not Box.
RcVal
Shared value node.