(* James Caldwell University of Wyoming, Department of Computer Science, Laramie WY COSC 4780 -- Principles of Programming Languages -- Spring 2006 *) (* test data for HW 10 *) let s0 = new_store 5 0;; let s42 = new_store 5 42;; meaning_of_loc (Loc 1);; meaning_of_int_expression (N 1) s0;; meaning_of_int_expression (N 5) s0;; meaning_of_int_expression (Deref (Loc 1)) s0;; meaning_of_int_expression (Deref (Loc 2)) s42;; meaning_of_int_expression (Add (Deref (Loc 2), N (-2))) s42;; meaning_of_int_expression (Add (Deref (Loc 2), Deref (Loc 1))) s42;; meaning_of_bool_expression (Eq (N 0, N 0)) s0;; meaning_of_bool_expression (Eq (N 0, N 1)) s0;; meaning_of_bool_expression (Eq (N 1, N 0)) s0;; meaning_of_bool_expression (Eq (Eq (N 0, N 1), Eq (N 1, N 0))) s0;; meaning_of_bool_expression (Eq (Eq (N 0, N 0), Eq (N 0, N 0))) s0;; print_store (meaning_of_command Skip s0);; print_store (meaning_of_command Skip s42);; print_store (meaning_of_command (Assign (Loc 1, N 1)) s0);; print_store (meaning_of_command ( Assign (Loc 1, Add (N 1, N 1))) s0);; print_store (meaning_of_command ( Seq (Assign (Loc 1, Add (N 1, N 1)), Assign (Loc 3, N 1))) s0) ;; print_store ( meaning_of_command ( Ite (Eq (Deref (Loc 1), N 0), Assign (Loc 3, N 99999), Assign (Loc 4, N 99999))) s0) ;; print_store ( meaning_of_command ( Ite (Eq (Deref (Loc 1), N 0), Assign (Loc 3, N 99999), Assign (Loc 4, N 99999))) s42) ;; print_store ( meaning_of_command ( While (Neg (Eq (Deref (Loc 1), N 5)), Seq (Assign (Loc 4, Add (Deref (Loc 4), N 1)), Assign (Loc 1, Add (Deref (Loc 1), N 1))))) s0) ;; print_store ( meaning_of_command ( Ite (Eq (Deref (Loc 1), N 0), While (Eq (N 0, N 0), Skip), Assign (Loc 4, N 99999))) s42) ;;