move some interpretExec functions
This commit is contained in:
parent
a53611230e
commit
04d54c12a5
@ -49,8 +49,7 @@ loadProgram newstack state = state & exec .~ newstack
|
|||||||
-- ends up on top).
|
-- ends up on top).
|
||||||
-- The empty-stack safety of interpretExec on empty stacks depends on the functions it calls.
|
-- The empty-stack safety of interpretExec on empty stacks depends on the functions it calls.
|
||||||
interpretExec :: State -> State
|
interpretExec :: State -> State
|
||||||
interpretExec state@(State {_exec = []}) = state & exec .~ []
|
interpretExec state@(State {_exec = e : es}) =
|
||||||
interpretExec state@(State {_exec = (e : es)}) =
|
|
||||||
case e of
|
case e of
|
||||||
(GeneInt val) -> interpretExec (state & exec .~ es & int .~ val : view int state)
|
(GeneInt val) -> interpretExec (state & exec .~ es & int .~ val : view int state)
|
||||||
(GeneFloat val) -> interpretExec (state & exec .~ es & float .~ val : view float state)
|
(GeneFloat val) -> interpretExec (state & exec .~ es & float .~ val : view float state)
|
||||||
@ -66,5 +65,6 @@ interpretExec state@(State {_exec = (e : es)}) =
|
|||||||
(Block block) -> interpretExec (state {_exec = block ++ es})
|
(Block block) -> interpretExec (state {_exec = block ++ es})
|
||||||
(PlaceInput val) -> interpretExec (state {_exec = (view input state Map.! val) : es})
|
(PlaceInput val) -> interpretExec (state {_exec = (view input state Map.! val) : es})
|
||||||
Close -> undefined -- remove Close constructor later?
|
Close -> undefined -- remove Close constructor later?
|
||||||
|
interpretExec state = state
|
||||||
|
|
||||||
-- Need to make interpretExec strict, right?
|
-- Need to make interpretExec strict, right?
|
||||||
|
Loading…
x
Reference in New Issue
Block a user