diff options
Diffstat (limited to 'urm.ml')
-rw-r--r-- | urm.ml | 14 |
1 files changed, 10 insertions, 4 deletions
@@ -23,12 +23,18 @@ 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 *) | 26 | let rec urm_run_pre pre = function |
27 | let 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 | ||
31 | let urm_run_trace = urm_run (* TODO *) | 30 | let urm_run = urm_run_pre (fun _ -> ()) |
31 | |||
32 | let 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 *) |
34 | let urm_mk cmd_list reg_list = { instptr = (instptr_mk cmd_list) ; regs = reg_list } | 40 | let urm_mk cmd_list reg_list = { instptr = (instptr_mk cmd_list) ; regs = reg_list } |