Expand description
§lambda-ref-cat
Lambda calculus with mutable reference cells and a pure-functional mark-
sweep garbage collector, built on comp_cat_rs. Spike 2 of a web-
engine reformulation targeting Tauri.
§Quick start
use lambda_ref_cat::run;
let value = run(r"let r = ref (\x. x) in r := (\y. y) ; !r").run()?;
assert_eq!(format!("{value}"), "\\y. y");§Grammar
expr ::= seq_expr
seq_expr ::= right_expr (";" right_expr)*
right_expr ::= lambda | let | fix | assign_expr
lambda ::= "\" ident "." expr
let ::= "let" ident "=" expr "in" expr
fix ::= "fix" ident "." expr
assign_expr ::= app_expr (":=" right_expr)?
app_expr ::= atom atom*
atom ::= ident | "(" expr ")" | "ref" atom | "!" atomModules§
- env
- Persistent lexical environments.
- error
- Project-wide error type.
- eval
- Tree-walking interpreter with heap-threading.
- gc
- Mark-sweep garbage collection.
- heap
- Persistent heap of mutable cells.
- lexer
- Tokenizer for the extended lambda calculus surface syntax.
- parser
- Recursive-descent parser for the extended lambda calculus surface syntax.
- syntax
- Abstract syntax and source-position newtypes.
- value
- Runtime values.
Constants§
- DEFAULT_
FUEL - Default step budget used by
run.
Functions§
- run
- Lex, parse, and evaluate
sourcewith the default fuel budget, returning just the resulting value. - run_
inspecting - Lex, parse, and evaluate
source, returning both the value and the final heap. Useful for tests that want to verify garbage-collection behaviour. - run_
with_ fuel - Lex, parse, and evaluate
sourcewith a caller-supplied fuel budget.