# let s0 = new_store 5 0;; val s0 : store = Store (5, ) # let s42 = new_store 5 42;; val s42 : store = Store (5, ) # meaning_of_loc (Loc 1);; - : loc = Loc 1 # meaning_of_int_expression (Num (Int 1)) s0;; - : int = 1 # meaning_of_int_expression (Num (Int 5)) s0;; - : int = 5 # meaning_of_int_expression (Deref (Loc 1)) s0;; - : int = 0 # meaning_of_int_expression (Deref (Loc 2)) s42;; - : int = 42 # meaning_of_int_expression (Plus (Deref (Loc 2), Num (Int (-2)))) s42;; - : int = 40 # meaning_of_int_expression (Plus (Deref (Loc 2), Deref (Loc 1))) s42;; - : int = 84 # meaning_of_bool_expression (Eq (Num (Int 0), Num (Int 0))) s0;; - : bool = true # meaning_of_bool_expression (Eq (Num (Int 0), Num (Int 1))) s0;; - : bool = false # meaning_of_bool_expression (Eq (Num (Int 1), Num (Int 0))) s0;; - : bool = false # meaning_of_bool_expression (Eq (Eq (Num (Int 0), Num (Int 1)), Eq (Num (Int 1), Num (Int 0)))) s0;; - : bool = true # meaning_of_bool_expression (Eq (Eq (Num (Int 0), Num (Int 0)), Eq (Num (Int 0), Num (Int 0)))) s0;; - : bool = true # print_store (meaning_of_command Skip s0);; Loc1: 0 Loc2: 0 Loc3: 0 Loc4: 0 Loc5: 0 - : unit = () # print_store (meaning_of_command Skip s42);; Loc1: 42 Loc2: 42 Loc3: 42 Loc4: 42 Loc5: 42 - : unit = () # print_store (meaning_of_command (Assign (Loc 1, Num (Int 1))) s0);; Loc1: 1 Loc2: 0 Loc3: 0 Loc4: 0 Loc5: 0 - : unit = () # print_store (meaning_of_command ( Assign (Loc 1, Plus (Num (Int 1), Num (Int 1)))) s0);; Loc1: 2 Loc2: 0 Loc3: 0 Loc4: 0 Loc5: 0 - : unit = () # print_store (meaning_of_command ( Seq (Assign (Loc 1, Plus (Num (Int 1), Num (Int 1))), Assign (Loc 3, Num (Int 1)))) s0);; Loc1: 2 Loc2: 0 Loc3: 1 Loc4: 0 Loc5: 0 - : unit = () # print_store ( meaning_of_command ( Ite (Eq (Deref (Loc 1), Num (Int 0)), Assign (Loc 3, Num (Int 99999)), Assign (Loc 4, Num (Int 99999)))) s0);; Loc1: 0 Loc2: 0 Loc3: 99999 Loc4: 0 Loc5: 0 - : unit = () # print_store ( meaning_of_command ( Ite (Eq (Deref (Loc 1), Num (Int 0)), Assign (Loc 3, Num (Int 99999)), Assign (Loc 4, Num (Int 99999)))) s42);; Loc1: 42 Loc2: 42 Loc3: 42 Loc4: 99999 Loc5: 42 - : unit = () # print_store ( meaning_of_command ( While (Not (Eq (Deref (Loc 1), Num (Int 5))), Seq (Assign (Loc 4, Plus (Deref (Loc 4), Num (Int 1))), Assign (Loc 1, Plus (Deref (Loc 1), Num (Int 1)))))) s0);; Loc1: 5 Loc2: 0 Loc3: 0 Loc4: 5 Loc5: 0 - : unit = () # print_store ( meaning_of_command ( Ite (Eq (Deref (Loc 1), Num (Int 0)), While (Eq (Num (Int 0), Num (Int 0)), Skip), Assign (Loc 4, Num (Int 99999)))) s42);; Loc1: 42 Loc2: 42 Loc3: 42 Loc4: 99999 Loc5: 42 - : unit = () #