From 21f879cf2ac5f51f827fe76c55915e56edc113b8 Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Wed, 21 Aug 2024 17:18:35 -0600 Subject: Fleshed out stage2 and made some big changes. Delegated behavior of Compile monad to monad transformers MaybeT and RWS. --- src/Main.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Main.hs') diff --git a/src/Main.hs b/src/Main.hs index 92e9a1d..9330df5 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -9,6 +9,7 @@ import GHC.IO.Exception (ExitCode (ExitFailure)) import Language.Fiddle.Ast import Language.Fiddle.Compiler (coloredFormat, compile_, printDiagnostic) import Language.Fiddle.Compiler.Stage0 +import Language.Fiddle.Compiler.Stage1 import Language.Fiddle.GenericTree (ToGenericSyntaxTree (toGenericSyntaxTree)) import qualified Language.Fiddle.Parser import qualified Language.Fiddle.Tokenizer @@ -22,11 +23,10 @@ main = do case argv of [filePath] -> do text <- Data.Text.IO.readFile filePath - let (diags, ma) = compile_ $ toStage1 =<< toStage0 filePath text + let (diags, ma) = compile_ $ toStage2 =<< toStage1 =<< toStage0 filePath text forM_ diags printDiagnostic case ma of Just ast -> do - putStrLn "\x1b[1;32mCompilation Succeeded:\x1b[0m" putStrLn $ BL.unpack $ encode $ toGenericSyntaxTree ast Nothing -> do putStrLn "\x1b[1;31mCompilation Failed\x1b[0m" -- cgit