Added default functions, isEmpty does not typecheck...
[cc1516.git] / examples / codeGen.spl
index 658ea6e..ebede23 100644 (file)
@@ -1,7 +1,36 @@
-f() {
-    return 2;
+//f(x, y) {
+//    var ret = 0;
+//    if (x < y) {
+//        ret = x;
+//    }
+//    else {
+//        ret = y;
+//    }
+//    return ret;
+//}//
+
+//main() {
+//     Int x1 = 1;
+//    var x2 = 4;
+//    var x3 = f(x1, x2);
+//    print(x1);
+//    x1 = 5;
+//    return x3 + x1;
+//}
+
+isE(x) :: [a] -> Bool {
+    if (x == []) {
+        return True;
+    } else {
+        return False;
+    }
 }
+
 main() {
-    var x = 3;
-    return 1 + 2 + x + f();
+    [Int] x1 = 1 : 2 : [];
+    [Int] x2 = 0 : x1;
+    [Int] x3 = [];
+    //Bool y1 = isEmpty(x2); //gives weird type error, not sure why
+    isEmpty(x2);
+    return;
 }