definition module Snug.Compile.Simulate from Control.Applicative import class Applicative, class pure, class <*> from Control.Monad import class Monad from Control.Monad.Identity import :: Identity, instance Functor Identity, instance Monad Identity, instance pure Identity, instance <*> Identity from Control.Monad.State import :: State, :: StateT, instance Functor (StateT s m), instance Monad (StateT s m), instance pure (StateT s m), instance <*> (StateT s m) from Data.Functor import class Functor from MIPS.MIPS32 import :: Instruction, :: Label from Snug.Syntax import :: BasicValue :: Simulator a :== State SimulationState a :: SimulationState simulate :: !(Simulator a) -> [Instruction] //* Build a constructor node with *n* arguments and push it to the stack. buildCons :: !Label !Int -> Simulator () //* Build a thunk node with *n* arguments and push it to the stack. buildThunk :: !Label !Int -> Simulator () //* Push a basic value to the stack. pushBasicValue :: !BasicValue -> Simulator () /** * Overwrite the node currently under evaluation with an indirection to the * node on top of the stack, and continue evaluating that node instead. */ indirectAndEval :: Simulator ()