X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=spl.icl;h=93374a5cd2b49ca57ab30fa7cdcaee8969ce8bcb;hb=c270b0fc79caa24c08c2d00c2e8205bbd47921ed;hp=63b1487a453dd4a28228778d119d6e914797b265;hpb=6b3981fb80952fe2c510b6f9b849adb0dff77d2c;p=cc1516.git diff --git a/spl.icl b/spl.icl index 63b1487..93374a5 100644 --- a/spl.icl +++ b/spl.icl @@ -16,6 +16,8 @@ from Text import class Text(concat), instance Text String import parse import lex +import sem +import AST from yard import :: Error, instance toString Error :: Opts = { @@ -56,20 +58,25 @@ Start w # lexOut = lexer cs # stdin = if (not args.lex) stdin (case lexOut of (Right toks) = - stdin <<< "---LEXER\n" <<< printTokens toks <<< "---LEXER\n" + stdin <<< "//LEXER\n" <<< printTokens toks <<< "//LEXER\n" _ = stdin) # parseOut = parser lexOut - # stdin = if (not args.parse) stdin (case parser lexOut of + # stdin = if (not args.parse) stdin (case parseOut of (Right ast) = - stdin <<< "---PARSER\n" <<< toString ast <<< "---PARSER\n" + stdin <<< "//PARSER\n" <<< toString ast <<< "//PARSER\n" (Left parse) = stdin <<< toString parse) + # semOut = sem parseOut + # stdin = case semOut of + (Right ast) = + stdin <<< "//TYPE\n" <<< toString ast <<< "//TYPE\n" + (Left parse) = stdin <<< toString parse = snd $ fclose stdin w where printTokens :: [Token] -> String printTokens ts = concat $ flatten $ map pt ts where - pt {line,column,token} = [toString line, ":", - toString column, ": ", printToString token, "\n"] + pt ({line,col},token) = [toString line, ":", + toString col, ": ", printToString token, "\n"] parseArgs :: *World -> (Opts, *World) parseArgs w