<<< " --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
stdin <<< "//PARSER\n" <<< toString parseOut <<< "//PARSER\n")
= case sem parseOut of
(Left e) = snd $ fclose (stdin <<< join "\n" (map toString e)) w
- (Right (semOut, gamma))
- # stdin = if (not args.sem) stdin (
- stdin <<< "//SEM\n" <<< toString gamma <<< "//SEM\n")
- = snd $ fclose stdin w
+ (Right constraints)
+ # stdin = if (not args.sem) stdin (stdin
+ <<< "//SEM G\n" <<< printConstraints constraints <<< "//SEMA\n")
+ = snd $ fclose (stdin <<< "\n") w
where
+ printConstraints :: Constraints -> String
+ printConstraints [] = ""
+ printConstraints [(t1, t2):ts] = concat [
+ "(", toString t1, ",", toString t2, ")"] +++ printConstraints ts
+
printTokens :: [Token] -> String
printTokens ts = concat $ flatten $ map pt ts
where