Simple call-by-need (i.e. lazy) interpreter for Lambda Calculus based off of
John Launchbury's "A Natural Semantics for Lazy Evaluation"
Uses the "Barendregt convention": All variable names are globally unique
(i.e. you cannot shadow variable names), and renames variables after substitution
to maintain this invariant.
Simple lambda calculus Abstract Syntax Tree.
Note that that apply applies a let-bound argument to an Expr.
This is to make sharing easier, by ensuring that arguments are in the heap.
case classLambda(name: String, term: Expr) extends Expr with Product with Serializable
case classLet(bindings: Map[String, Expr], term: Expr) extends Expr with Product with Serializable
case classReduceState(heap: Map[String, Expr], freshVars: Stream[String]) extends Product with Serializable
case classVar(name: String) extends Expr with Product with Serializable
Simple call-by-need (i.e. lazy) interpreter for Lambda Calculus based off of John Launchbury's "A Natural Semantics for Lazy Evaluation" Uses the "Barendregt convention": All variable names are globally unique (i.e. you cannot shadow variable names), and renames variables after substitution to maintain this invariant.