updates'
authorMart Lubbers <mart@martlubbers.net>
Mon, 11 Mar 2019 09:28:52 +0000 (10:28 +0100)
committerMart Lubbers <mart@martlubbers.net>
Mon, 11 Mar 2019 09:28:52 +0000 (10:28 +0100)
git pus

Makefile
main.icl
tests/preamble.mfp

index c0b5828..d532f0d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
 CLM?=clm
-CLMFLAGS?=-b
+CLMFLAGS?=-nr
 CLMLIBS?=-IL Platform
 
 all: main
index 9f9fd86..136c0e1 100644 (file)
--- a/main.icl
+++ b/main.icl
@@ -32,20 +32,21 @@ opts =
        , Option ['g'] ["gen"]       (NoArg (const MGen))       "Up to and including generation"
        ]
 
-Start :: *World -> Either [String] [String]
+Start :: *World -> *World
 Start w
        # ([argv0:args], w) = getCommandLine w
        # (mode, positionals, errs) = getOpt Permute opts args
        # mode = foldl (o) id mode MInterpret
-       | not (errs =: []) = Left [e +++ "\n"\\e<-errs]
-       | not (positionals =: []) = Left ["Positional arguments not allowed"]
+//     | not (errs =: []) = Left [e +++ "\n"\\e<-errs]
+//     | not (positionals =: []) = die ["Positional arguments not allowed"] w
        # (io, w) = stdio w
        # (cs, io) = chars io
-       # (_, w) = fclose io w
-       = case mode of
+       # mstr = case mode of
                MHelp = Left [usageInfo ("Usage: " +++ argv0 +++ " [opts]\n") opts]
                MLex = map (\x->toString x +++ "\n") <$> lex cs
                MParse = map (\x->toString x +++ "\n") <$> (lex cs >>= parse)
                MType = (\(e, x)->["type: ",toString x, "\n", toString e]) <$> (lex cs >>= parse >>= check)
                MInterpret = (\x->[toString x]) <$> (lex cs >>= parse >>= check >>= int o fst)
                MGen = lex cs >>= parse >>= check >>= gen o fst
+       = setReturnCode (either (const 1) (const 0) mstr)
+               (snd (fclose (foldr fwrites io (either id id mstr)) w))
index 8c01e96..120f93f 100644 (file)
@@ -6,4 +6,4 @@ $ ifxr 0 x y = x y;
 + ifxl 6 = code add;
 if = code if;
 fac i = if (i == 0) 1 (i * fac (i - 1));
-start = fac;
+start = fac 10;