X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=lex.icl;h=cc4bc2f9a46eaa6fcc1074971d9ab902c9fbc848;hb=9b74ace948b5035934d377a712eddda653bc640e;hp=f050062d7f172760b708a867a469d06cba3dc75c;hpb=19c5f39c61f1692641570dc3cf13360e7dff5cdf;p=cc1516.git diff --git a/lex.icl b/lex.icl index f050062..cc4bc2f 100644 --- a/lex.icl +++ b/lex.icl @@ -1,3 +1,32 @@ -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)