Safe Haskell | None |
---|
DDC.Core.Eval
Description
Single step evaluator for the Disciple Core language.
This is a direct implementation of the operational semantics and is by no means fast, or a substitute for a real interpreter. Programs run with this evaluator will have an asymptotic complexity much worse than if they were compiled. This evaluator is intended for experimenting with the language semantics, and not running actual programs.
- evalProfile :: Profile Name
- data StepResult
- = StepProgress Store (Exp () Name)
- | StepDone
- | StepStuck
- | StepMistyped (Error () Name)
- force :: Store -> Exp () Name -> StepResult
- step :: Store -> Exp () Name -> StepResult
Documentation
evalProfile :: Profile NameSource
Core language fragment that can be directly evaluated.
data StepResult Source
The result of stepping some expression.
Constructors
StepProgress Store (Exp () Name) | Expression progressed to a new state. |
StepDone | Expression cannot step and is a (weak) value. We're done already. |
StepStuck | Expression cannot step, and is not a (weak) value. The original expression was mistyped, or something is wrong with the interpreter. |
StepMistyped (Error () Name) | Expression is stuck, and we know for sure it's mistyped. |
Instances
Show StepResult |
Arguments
:: Store | Current store. |
-> Exp () Name | Expression to force. |
-> StepResult | Result of forcing it. |
Single step a core expression to a value.
As opposed to step
, if the provided expression is the location of a
Thunk, then the thunk will be forced.