ContentsIndex
Gulik.Eval
Contents
Interp monad actions
Evaluation functions
Description
Contains the core Gulik evaluator.
Synopsis
push :: Value -> Interp ()
pop :: Interp Value
evalEnv :: Env -> [Value] -> [Expr] -> Either InterpError ([Value], Env)
eval :: Env -> [Value] -> [Expr] -> Either InterpError [Value]
exec :: Env -> [Value] -> [Expr] -> Either InterpError Env
Interp monad actions
These are useful for building buildins.
push
:: ValueValue to push.
-> Interp ()Resulting Interp monad action.
Push a value onto the interpreter stack.
pop
:: Interp ValueInterp monad action containing popped value.
Pop a value from the interpreter stack.
Evaluation functions
evalEnv
:: EnvInitial environment.
-> [Value]Initial stack.
-> [Expr]Expressions to evaluate.
-> Either InterpError ([Value], Env)Error, or resulting (stack, environment) pair.
Pure functional interface to the interpreter: takes an environment, an initial stack, and a list of expressions; returns the new stack and environment, or an error.
eval
:: EnvInitial environment.
-> [Value]Initial stack.
-> [Expr]Expressions to evaluate.
-> Either InterpError [Value]Error, or resulting stack.
Version of evalEnv which discards environment.
exec
:: EnvInitial environment.
-> [Value]Initial stack.
-> [Expr]Expressions to evaluate.
-> Either InterpError EnvError, or resulting environment.
Version of the above which discards stack.
Produced by Haddock version 0.7