(* 15-212, Spring 2011 *) (* Michael Erdmann *) (* Code for Lecture 1: Evaluation and Typing *) (* Integers *) ~1 : int; (* NOT -1 *) 4 : int; ~3+2 : int; 5 div 2 : int; (* Reals *) 3.14 : real; 5.0 / 2.0 : real; (* NOT 5 / 2 *) (* Booleans *) true : bool; false : bool; if 0 = 0 then 1.0 else 2.0 : real; if true then 4.0 else 1.0/0.0: real; (* Typing and Evaluation *) (* Some ill-typed expressions *) (* 2.0 + 1; if true then 1 else 2.0; true + 0; *) (* Some well-typed expressions without a value *) (* 1 div 0; if 1 div 0 = 0 then true else false; if false then 4 else 1 div 0; *)