From 0027c7b647e1b345badbb01bcafd22feee075470 Mon Sep 17 00:00:00 2001 From: pacien Date: Sun, 22 Apr 2018 22:39:56 +0200 Subject: Implement program execution from command line --- reg.ml | 3 +++ 1 file changed, 3 insertions(+) (limited to 'reg.ml') diff --git a/reg.ml b/reg.ml index c452282..45bbb4b 100644 --- a/reg.ml +++ b/reg.ml @@ -8,6 +8,7 @@ open Common let reg_idx (Reg(idx, _)) = idx let reg_val (Reg(_, value)) = value let reg_compar l r = (reg_val l) - (reg_val r) +let reg_string (Reg (index, value)) = (string_of_int index) ^ ": " ^ (string_of_int value) let regs_get reglist index = List.find (fun (Reg(idx, _)) -> idx = index) reglist |> reg_val @@ -15,3 +16,5 @@ let regs_get reglist index = let regs_set reglist index value = Reg(index, value) :: List.filter (fun (Reg(idx, _)) -> idx != index) reglist +let rec regs_string reglist = List.map (reg_string) reglist |> String.concat ", " + -- cgit v1.2.3