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