Newer changes

This commit is contained in:
Rakarake 2023-03-28 15:26:35 +02:00
commit b35c19572f
10 changed files with 279 additions and 75 deletions

View file

@ -1,5 +1,4 @@
{-# LANGUAGE OverloadedRecordDot #-}
module Main where
import Control.Monad (when)
@ -20,7 +19,6 @@ import System.Exit (ExitCode (ExitFailure),
exitFailure, exitSuccess,
exitWith)
import System.IO (stderr)
import Codegen.Codegen (generateCode)
import Compiler (compile)
import Grammar.ErrM (Err)
@ -105,6 +103,10 @@ main' opts s = do
--let lifted = lambdaLift typechecked
--printToErr $ printTree lifted
printToErr "\n -- Compiler --"
let monomorphized = monomorphize typechecked
printToErr $ show monomorphized
-- printToErr "\n-- Lambda Lifter --"
-- let lifted = lambdaLift typechecked
-- printToErr $ printTree lifted
@ -122,6 +124,19 @@ main' opts s = do
compile generatedCode
spawnWait "./output/hello_world"
--printToErr "\n -- Compiler --"
--generatedCode <- fromCompilerErr $ generateCode (monomorphize typechecked)
--putStrLn generatedCode
--check <- doesPathExist "output"
--when check (removeDirectoryRecursive "output")
--createDirectory "output"
--when debug $ do
-- writeFile "output/llvm.ll" generatedCode
-- debugDotViz
--compile generatedCode
--spawnWait "./hello_world"
-- interpred <- fromInterpreterErr $ interpret lifted
-- putStrLn "\n-- interpret"
-- print interpred