vm: added noop instruction, various other improvements
This commit is contained in:
@@ -25,6 +25,7 @@ type instr =
|
|||||||
| Jump of int
|
| Jump of int
|
||||||
| JumpF of int (* jump if false. *)
|
| JumpF of int (* jump if false. *)
|
||||||
| End
|
| End
|
||||||
|
| NOOP
|
||||||
|
|
||||||
type vm_state = {
|
type vm_state = {
|
||||||
mutable i : int;
|
mutable i : int;
|
||||||
|
|||||||
+2
-1
@@ -57,5 +57,6 @@ and interpret state =
|
|||||||
(match (pop_one state) with
|
(match (pop_one state) with
|
||||||
| Nil -> state.i <- target
|
| Nil -> state.i <- target
|
||||||
| _ -> ()); interpret state
|
| _ -> ()); interpret state
|
||||||
| End -> ())
|
| End -> ()
|
||||||
|
| NOOP -> interpret state)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user