aboutsummaryrefslogtreecommitdiff
path: root/urm.ml
diff options
context:
space:
mode:
Diffstat (limited to 'urm.ml')
-rw-r--r--urm.ml15
1 files changed, 11 insertions, 4 deletions
diff --git a/urm.ml b/urm.ml
index 49e970b..3b7068b 100644
--- a/urm.ml
+++ b/urm.ml
@@ -23,12 +23,19 @@ let urm_apply urm =
23 | _, _ -> { instptr = urm.instptr ; regs = urm.regs } |> urm_move_down 23 | _, _ -> { instptr = urm.instptr ; regs = urm.regs } |> urm_move_down
24 in if instptr_end urm.instptr then urm else aux (instptr_get urm.instptr) 24 in if instptr_end urm.instptr then urm else aux (instptr_get urm.instptr)
25 25
26(* Launches the URM *) 26let rec urm_run_pre pre = function
27let rec urm_run = function
28 | { instptr = InstPtr(_, []) ; regs = reg_list } -> reg_list 27 | { instptr = InstPtr(_, []) ; regs = reg_list } -> reg_list
29 | urm -> urm_apply urm |> urm_run 28 | urm -> pre urm; urm_apply urm |> urm_run_pre pre
30 29
31let urm_run_trace = urm_run (* TODO *) 30let urm_run = urm_run_pre (fun _ -> ())
31
32let urm_run_trace =
33 let print_func u =
34 print_endline (instptr_string u.instptr);
35 print_endline (regs_string u.regs);
36 print_newline ()
37 in urm_run_pre (print_func)
32 38
33(* Creates an URM from a command list and a register list *) 39(* Creates an URM from a command list and a register list *)
34let urm_mk cmd_list reg_list = { instptr = (instptr_mk cmd_list) ; regs = reg_list } 40let urm_mk cmd_list reg_list = { instptr = (instptr_mk cmd_list) ; regs = reg_list }
41