Solved 30+ WARNINGS!! 😎

This commit is contained in:
Samuel Hammersberg 2023-03-28 17:49:47 +02:00
parent c77139dfa8
commit d8a75d6643
2 changed files with 25 additions and 43 deletions

View file

@ -1,25 +1,26 @@
module Compiler (compile) where
import Grammar.ErrM (Err)
import System.Exit (exitFailure, exitSuccess)
import System.IO (BufferMode (NoBuffering), hClose, hFlush,
hGetContents, hPutStr, hPutStrLn,
hSetBuffering, stderr)
import System.Process.Extra (CreateProcess (..),
StdStream (CreatePipe), createProcess,
proc, readCreateProcess, shell,
spawnCommand, waitForProcess)
import System.Process.Extra (
readCreateProcess,
shell,
)
--spawnWait s = spawnCommand s >>= \s >>= waitForProcess
-- 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"
, "-"]
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