Module Lambda_lib.Interpret

type error =
  1. | UnknownVariable of string
  2. | DivisionByZero
  3. | TypeMismatch
  4. | StepLimitExceeded

Error types for interpreter

type value =
  1. | VInt of int
  2. | VClosure of string * string Ast.t * environment
  3. | VBuiltin of string * value -> (value, error) Base.Result.t
  4. | VUnit

Values in our interpreter

and environment = (string * value) list
val eval_expr : ?max_steps:int -> string Ast.t -> (value, error) Base.Result.t

Evaluate an AST expression with optional step limit