bburdette / schelme / Schelme.Run

Some functions for compiling and running schelme scripts.

compile : String -> Result String (List (Schelme.EvalStep.Term a))

parse a string, emitting a series of Terms, which will hopefully be a valid schelme program.

run : Schelme.EvalStep.NameSpace a -> a -> List (Schelme.EvalStep.Term a) -> Result String ( Schelme.EvalStep.NameSpace a, a, Schelme.EvalStep.Term a )

given a namespace (for instance Prelude.prelude) and a state (see examples), and a schelme program, run the program to completion, emitting an updated namespace, state, and final Term

evalBodyLimit : Schelme.EvalStep.EvalBodyStep a -> Basics.Int -> Schelme.EvalStep.EvalBodyStep a

The way to go for incremental execution. Given an EvalBodyStep (the normal top level of a running schelme program), execute it up to /count/ evals, returning the last EvalBodyStep state.

runBody : Schelme.EvalStep.EvalBodyStep a -> Result String ( Schelme.EvalStep.NameSpace a, a, Schelme.EvalStep.Term a )

starting with an EvalBodyStep, run to completion

runBodyCount : Schelme.EvalStep.EvalBodyStep a -> Basics.Int -> Result String ( Schelme.EvalStep.NameSpace a, a, ( Basics.Int, Schelme.EvalStep.Term a ) )

continue execution of an EvalBodyStep, returning the final Term and number of evals used.

runBodyLimit : Schelme.EvalStep.EvalBodyStep a -> Basics.Int -> Result String ( Schelme.EvalStep.NameSpace a, a, ( Basics.Int, Schelme.EvalStep.Term a ) )

run a schelme EvalBodyStep with a max number of evals, erroring out if the max is reached.

runCount : Schelme.EvalStep.NameSpace a -> a -> List (Schelme.EvalStep.Term a) -> Result String ( Schelme.EvalStep.NameSpace a, a, ( Basics.Int, Schelme.EvalStep.Term a ) )

run a schelme program, emitting the usual products but also the number of evals taken

runLimit : Schelme.EvalStep.NameSpace a -> a -> Basics.Int -> List (Schelme.EvalStep.Term a) -> Result String ( Schelme.EvalStep.NameSpace a, a, ( Basics.Int, Schelme.EvalStep.Term a ) )

run a schelme program with a max number of evals, erroring out if the max is reached.

runNamedFunction : Schelme.EvalStep.NameSpace a -> a -> String -> List (Schelme.EvalStep.Term a) -> Result String ( Schelme.EvalStep.NameSpace a, a, Schelme.EvalStep.Term a )

find a schelme function by name and run it, with the passed list of args.

runFunctionStep : Schelme.EvalStep.EvalFtnStep a -> Result String ( Schelme.EvalStep.NameSpace a, a, Schelme.EvalStep.Term a )

run a function to completion, returning updated namespace, state, and result term