Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
- data Ins reg val
- data MachineSpec m pc reg val = MachineSpec {}
- data MachineState pc reg val
- = MachineState { }
- | MachineTerminated
- parse :: (Integral a, Read a) => String -> [Ins String a]
- step :: (Monad m, Ix pc, Num pc, Ord reg, Integral val, Ord val) => MachineSpec m pc reg val -> MachineState pc reg val -> m (MachineState pc reg val)
- loop :: (Monad m, Ix pc, Num pc, Ord reg, Integral val, Ord val) => MachineSpec m pc reg val -> MachineState pc reg val -> m ()
- day18a :: String -> Int64
- day18b :: String -> Int
Documentation
A single instruction.
Either
represents either a register reference or an immediate value.
data MachineSpec m pc reg val Source #
A specification for how to run a machine.
data MachineState pc reg val Source #
The current state of a machine.
MachineState | The machine is running. |
MachineTerminated | The machine is stopped. |
parse :: (Integral a, Read a) => String -> [Ins String a] Source #
Parse an assembly listing to instructions.
step :: (Monad m, Ix pc, Num pc, Ord reg, Integral val, Ord val) => MachineSpec m pc reg val -> MachineState pc reg val -> m (MachineState pc reg val) Source #
Evaluate a single instruction.
loop :: (Monad m, Ix pc, Num pc, Ord reg, Integral val, Ord val) => MachineSpec m pc reg val -> MachineState pc reg val -> m () Source #
Run a machine until its state reaches MachineTerminated
.