curry gotcha
[cc1516.git] / spl.icl
diff --git a/spl.icl b/spl.icl
index 383b84e..0e22a1e 100644 (file)
--- a/spl.icl
+++ b/spl.icl
@@ -42,7 +42,13 @@ preamble (AST fd) = AST (pre ++ fd)
                                IfStmt (FunExpr zero "isEmpty" [VarExpr zero (VarDef "x" [])] [])
                                        []
                                        [FunStmt "1printchar" [VarExpr zero (VarDef "x" [FieldHd])] []
-                                       ,FunStmt "1printstr" [VarExpr zero (VarDef "x" [FieldTl])] []]]]
+                                       ,FunStmt "1printstr" [VarExpr zero (VarDef "x" [FieldTl])] []]]
+                       ,
+                       FunDecl zero "1printbool" ["x"] Nothing [] [
+                               IfStmt (VarExpr zero (VarDef "x" []))
+                                       [FunStmt "1printstr" [makeStrExpr zero $ fromString "True"] []]
+                                       [FunStmt "1printstr" [makeStrExpr zero $ fromString "False"] []]]
+                       ] 
 
 Start :: *World -> *World
 Start w
@@ -50,14 +56,12 @@ Start w
 # (stdin, w) = stdio w
 | args.version
        # stdin = stdin 
-               <<< "spl 0.1 (17 march 2016)\n"
+               <<< "spl 1.0 (9 June 2016)\n"
                <<< "Copyright Pim Jager and Mart Lubbers\n"
        = snd $ fclose stdin w
 | args.help
        # stdin = stdin 
                <<< "Usage: " <<< args.program <<< " [OPTION] [FILE]\n"
-               <<< "<spl> ::= <spl> <parser> <lexer>\n"
-               <<< "Lex parse and either FILE or stdin\n"
                <<< "\n"
                <<< "Options:\n"
                <<< "  --help             Show this help\n"
@@ -82,9 +86,10 @@ Start w
                                stdin <<<  "//PARSER\n" <<< toString parseOut <<< "//PARSER\n")
                        = case sem (preamble parseOut) of
                                (Left e) = snd $ fclose (stdin <<< join "\n" (map toString e) <<< "\n") w
-                               (Right ast)
+                               (Right (ast, gam))
                                # stdin = if (not args.sem) stdin (stdin
-                                       <<< "//SEM G\n" <<< toString ast <<< "//SEMA\n")
+                                       <<< "//SEM AST\n" <<< toString ast <<< "//SEM AST\n"
+                    <<< "//SEM GAMMA\n" <<< toString gam <<< "//SEM GAMMA\n")
                                = case gen ast of
                                        (Left e) = snd $ fclose (stdin <<< e) w
                                        (Right asm)