Use TAst in CodeGen

This commit is contained in:
Ethan Girouard 2024-12-11 15:58:59 -05:00
parent d53362f882
commit 5a63229e74
Signed by: eta357
GPG Key ID: 7BCDC36DFD11C146
2 changed files with 8 additions and 4 deletions

View File

@ -12,6 +12,7 @@ import Windows12.Parser (programP)
import System.Environment (getArgs) import System.Environment (getArgs)
import LLVM.Pretty import LLVM.Pretty
import Windows12.Ast import Windows12.Ast
import Windows12.Semant (convert)
import Windows12.CodeGen (codegen) import Windows12.CodeGen (codegen)
@ -26,4 +27,7 @@ main = do
test <- T.readFile inputFile test <- T.readFile inputFile
case parse programP inputFile test of case parse programP inputFile test of
Left err -> print err Left err -> print err
Right ast -> TL.writeFile outputFile (ppllvm (codegen (cs inputFile) ast)) Right ast ->
case convert ast of
Left err -> putStrLn err
Right ast -> TL.writeFile outputFile (ppllvm (codegen (cs inputFile) ast))

View File

@ -1,8 +1,8 @@
module Windows12.CodeGen where module Windows12.CodeGen where
import Data.Text (Text) import Data.Text (Text)
import Windows12.Ast import Windows12.TAst
import LLVM.AST (Module) import LLVM.AST (Module)
codegen :: Text -> Program -> Module codegen :: Text -> TProgram -> Module
codegen filename (Program structs enums funcs) = undefined codegen filename (TProgram structs enums funcs) = undefined