module HW08Programs where import HW08Imp program1 :: Command program1 = Print "x" program2 :: Command program2 = Print "x" `Seq` Assign "x" (Con 42) `Seq` Print "x" `Seq` Print "y" program3 :: Command program3 = Print "x" `Seq` Assign "x" (Con 42) `Seq` Print "x" `Seq` Assign "x" (Var "x" `Add` Var "x") `Seq` Print "x" program4 :: Command program4 = While (Var "x" `LEQ` Con 9) ( Assign "x" (Var "x" `Add` Con 1) `Seq` Print "x" ) program5 :: Command program5 = Assign "x" (Con 1) `Seq` While (Var "x" `LEQ` Con 100) ( Print "x" `Seq` Assign "x" (Var "x" `Mul` Con 2) ) program6 :: Command program6 = Assign "x" (Con 1) `Seq` Assign "y" (Con 1) `Seq` While (Var "x" `LEQ` Con 30) ( Print "x" `Seq` Assign "tmp" (Var "y") `Seq` Assign "y" (Var "x" `Add` Var "y") `Seq` Assign "x" (Var "tmp") ) program7 :: Command program7 = Assign "x" (Con 42) `Seq` Assign "y" (Con 40) `Seq` If (Equal (Var "x") (Con 42)) ( Print "x" ) ( Print "y" ) program8 :: Command program8 = Assign "x" (Con 42) `Seq` Assign "y" (Con 40) `Seq` If (Not (Equal (Var "x") (Con 42))) ( Print "x" ) ( Print "y" )