Write llvm to file
parent
5fc26a7acd
commit
c296d15f85
|
@ -21,3 +21,5 @@ cabal.project.local
|
|||
cabal.project.local~
|
||||
.HTF/
|
||||
.ghc.environment.*
|
||||
a.out
|
||||
a.out.ll
|
|
@ -5,6 +5,7 @@ module Main (main) where
|
|||
|
||||
-- import Compiler.ExeGen
|
||||
import Compiler.LLVMGen
|
||||
import Data.Text.Lazy qualified as L
|
||||
import Data.Text.Lazy.IO qualified as T
|
||||
import Parser.Expr
|
||||
import System.Environment
|
||||
|
@ -17,5 +18,9 @@ main :: IO ()
|
|||
main = do
|
||||
fileName <- fmap head getArgs
|
||||
contents <- readFile fileName
|
||||
T.putStrLn "- Parsing file..."
|
||||
let parsed = getRight (parseExpr contents)
|
||||
T.putStrLn (llvmGen parsed)
|
||||
T.putStrLn "- Generating LLVM to './a.out.ll'..."
|
||||
let llvm = llvmGen parsed
|
||||
writeFile "a.out.ll" (L.unpack llvm)
|
||||
T.putStrLn "- Done."
|
||||
|
|
Reference in New Issue