X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=spl.icl;h=c42412c6fc9bca69e1da3914a037f85bc9379db6;hb=b6c2892b454651c4f3b2412d5b36f273ef6a3128;hp=1690d71850c97d1d312ee9c9808fa992dd623fac;hpb=a363f872ee96379d8b0b9b14cb6faec9d74e7e92;p=cc1516.git diff --git a/spl.icl b/spl.icl index 1690d71..c42412c 100644 --- a/spl.icl +++ b/spl.icl @@ -12,6 +12,7 @@ import Data.Maybe import Data.Func import System.CommandLine import GenPrint +import Data.Map from Text import class Text(concat,join), instance Text String import parse @@ -50,7 +51,8 @@ Start w <<< " --help Show this help\n" <<< " --version Show the version\n" <<< " --[no-]lex Lexer output(default: disabled)\n" - <<< " --[no-]parse Parser output(default: enabled)\n" + <<< " --[no-]parse Parser output(default: disabled)\n" + <<< " --[no-]sem Semantic analysis output(default: enabled)\n" = snd $ fclose stdin w # (contents, stdin, w) = readFileOrStdin stdin args.fp w = case contents of @@ -67,10 +69,11 @@ Start w stdin <<< "//PARSER\n" <<< toString parseOut <<< "//PARSER\n") = case sem parseOut of (Left e) = snd $ fclose (stdin <<< join "\n" (map toString e)) w - (Right semOut) - # stdin = if (not args.sem) stdin ( - stdin <<< "//SEM\n" <<< toString semOut <<< "//SEM\n") - = snd $ fclose stdin w + (Right (semOut, gamma)) + # stdin = if (not args.sem) stdin (stdin + <<< "//SEM G\n" <<< toString gamma <<< "//SEM A\n" + <<< "//SEM A\n" <<< toString semOut <<< "//SEM A\n") + = snd $ fclose (stdin <<< "\n") w where printTokens :: [Token] -> String printTokens ts = concat $ flatten $ map pt ts