t2 <- typeCheckExp e
if t == t2 || t2 == NoType then do
(m:ms) <- get
- case insertLookupWithKey (\k a1 a2 -> a1) i t m of
+ case insertLookupWithKey (\k a1 a2 -> a1) i t m of
(Nothing,m') -> put (m':ms)
_ -> fail $ "Duplicate variable declaration: "++show i
return NoType
putStrLn "\nParse Successful!"
showTree v (Program s)
runStateT (mapM typeCheckStm s) [empty]
+ print "The program is type-correct!!"
return ()
showTree :: (Show a, Print a) => Int -> a -> IO ()
--- /dev/null
+int a = readInt;
+bool b = readBool;
+
+if (a < 3) {
+ print -a;
+}
+else
+ print a;
+
+while (! b){
+ int a = a * 42 + readInt;
+ if ( a == 13) b = false;
+}
+
+while ( a-- > 0) {
+ print a;
+}
+
+while ( b = readBool){
+ int c = readInt;
+ print c*a;
+}
+
+bool c = readBool;
+
+if (c) print 42;