aboutsummaryrefslogtreecommitdiff
path: root/app/Main.hs
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2022-09-09 12:41:03 +0100
committerJuan J. Martinez <jjm@usebox.net>2022-09-09 12:41:03 +0100
commitcdf88f13008cd3f6511d466c1078ae7b2f983faf (patch)
treea881aac3c0db1377d667955120bbf26fa4894b6f /app/Main.hs
parent69c02169ef381d394323e9d26d0cb48db89fb7d4 (diff)
downloadmicro-lang-hs-cdf88f13008cd3f6511d466c1078ae7b2f983faf.tar.gz
micro-lang-hs-cdf88f13008cd3f6511d466c1078ae7b2f983faf.zip
Refactored the compiler result to plug in the code generator
Also some tweaks in error reporting.
Diffstat (limited to 'app/Main.hs')
-rw-r--r--app/Main.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/Main.hs b/app/Main.hs
index 5a16129..db970d9 100644
--- a/app/Main.hs
+++ b/app/Main.hs
@@ -71,8 +71,8 @@ compileFile filename onlyParse = do
Left err -> hPutStrLn stderr (showParserError err) >> exitFailure
Right ast -> do
res <- return $ evalState (compileAll ast) startState
- case res of
- Right _ -> if onlyParse then exitSuccess else print ast
+ case crExit res of
+ Right out -> if onlyParse then exitSuccess else hPutStrLn stdout out
Left errs -> hPutStr stderr (showErrorList errs) >> exitFailure
main :: IO ()