LaunchburyInterpreter

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.

class Object
trait Matchable
class Any

Type members

Classlikes

case
class Apply(term: Expr, arg: String) extends Expr
sealed abstract
class Expr

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.

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
class Lambda(name: String, term: Expr) extends Expr
case
class Let(bindings: String ==>> Expr, term: Expr) extends Expr
case
class ReduceState(heap: String ==>> Expr, freshVars: LazyList[String])
case
class Var(name: String) extends Expr

Value members

Concrete methods

def evaluate(e: Expr): Expr
def main(args: Array[String]): Unit

Concrete fields

val S: MonadState[[_] =>> State[ReduceState, _$53], ReduceState]