churf/src/Compiler.hs
Samuel Hammersberg d8a75d6643 Solved 30+ WARNINGS!! 😎
2023-03-28 17:49:47 +02:00

26 lines
617 B
Haskell

module Compiler (compile) where
import System.Process.Extra (
readCreateProcess,
shell,
)
-- spawnWait s = spawnCommand s >>= \s >>= waitForProcess
optimize :: String -> IO String
optimize = readCreateProcess (shell "opt --O3 -S")
compileClang :: String -> IO String
compileClang =
readCreateProcess . shell $
unwords
[ "clang++" -- , "-Lsrc/GC/lib/", "-l:libgcoll.a"
, "-fno-exceptions -x"
, "ir"
, "-o"
, "output/hello_world"
, "-"
]
compile :: String -> IO String
compile s = optimize s >>= compileClang