Write llvm to file

pull/21/head
Ethan Reece 2023-09-29 02:26:49 -05:00
parent 5fc26a7acd
commit c296d15f85
Signed by: me
GPG Key ID: D3993665FF92E1C3
2 changed files with 8 additions and 1 deletions

2
.gitignore vendored
View File

@ -21,3 +21,5 @@ cabal.project.local
cabal.project.local~
.HTF/
.ghc.environment.*
a.out
a.out.ll

View File

@ -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."