The compiler now also runs the outputed program.

This commit is contained in:
Samuel Hammersberg 2023-03-24 18:52:12 +01:00
parent b08ae7aef1
commit 3e31fe0ea5

View file

@ -21,9 +21,11 @@ import System.Directory (createDirectory, doesPathExist,
removeDirectoryRecursive, removeDirectoryRecursive,
setCurrentDirectory) setCurrentDirectory)
import System.Environment (getArgs) import System.Environment (getArgs)
import System.Exit (exitFailure, exitSuccess) import System.Exit (ExitCode, exitFailure,
exitSuccess)
import System.IO (stderr) import System.IO (stderr)
import System.Process.Extra (spawnCommand, waitForProcess) import System.Process.Extra (readCreateProcess, shell,
spawnCommand, waitForProcess)
import TypeChecker.TypeChecker (typecheck) import TypeChecker.TypeChecker (typecheck)
main :: IO () main :: IO ()
@ -65,6 +67,7 @@ main' debug s = do
debugDotViz debugDotViz
compile generatedCode compile generatedCode
spawnWait "./hello_world"
-- interpred <- fromInterpreterErr $ interpret lifted -- interpred <- fromInterpreterErr $ interpret lifted
-- putStrLn "\n-- interpret" -- putStrLn "\n-- interpret"
-- print interpred -- print interpred
@ -80,7 +83,8 @@ debugDotViz = do
mapM_ spawnWait commands mapM_ spawnWait commands
setCurrentDirectory ".." setCurrentDirectory ".."
return () return ()
where
spawnWait :: String -> IO ExitCode
spawnWait s = spawnCommand s >>= waitForProcess spawnWait s = spawnCommand s >>= waitForProcess
printToErr :: String -> IO () printToErr :: String -> IO ()
printToErr = hPutStrLn stderr printToErr = hPutStrLn stderr