summaryrefslogtreecommitdiff
path: root/src/Main.hs
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2024-08-21 17:18:35 -0600
committerJosh Rahm <joshuarahm@gmail.com>2024-08-21 17:18:35 -0600
commit21f879cf2ac5f51f827fe76c55915e56edc113b8 (patch)
tree78adb4cb69fec285cbb2fd82191596c97e3f18c9 /src/Main.hs
parentd6fae8c7de4bc952ba88f0c86cad9e8141eaf3df (diff)
downloadfiddle-21f879cf2ac5f51f827fe76c55915e56edc113b8.tar.gz
fiddle-21f879cf2ac5f51f827fe76c55915e56edc113b8.tar.bz2
fiddle-21f879cf2ac5f51f827fe76c55915e56edc113b8.zip
Fleshed out stage2 and made some big changes.
Delegated behavior of Compile monad to monad transformers MaybeT and RWS.
Diffstat (limited to 'src/Main.hs')
-rw-r--r--src/Main.hs4
1 files changed, 2 insertions, 2 deletions
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"