-module lex
+implementation module lex
-Start = "Hello World!\n"
+import Data.Either
+import Data.List
+import StdString
+import System.CommandLine
+import StdFile
+import StdMisc
+
+// Misschien moeten we hier continuation style van maken
+instance toString lexerOutput where
+ toString l = "dit is een lexer output, danwel error\n"
+
+lexer :: [Char] -> LexerOutput
+lexer _ = Left "Not Implemented"
+
+Start :: *World -> *World
+Start w
+# (args, w) = getCommandLine w // We lezen nu nog standaard van stdin
+# (out, w) = stdio w
+# (toparse, out) = readEntireFile out
+# out = out <<< toString (lexer toparse)
+# (b, w) = fclose out w
+| not b = setReturnCode 1 w
+= w
+ where
+ readEntireFile :: *File -> *([Char], *File)
+ readEntireFile f
+ # (b, c, f) = freadc f
+ | not b = ([], f)
+ # (cs, f) = readEntireFile f
+ = ([c:cs], f)