Renamed the compile function to generate code

This commit is contained in:
Samuel Hammersberg 2023-03-08 10:25:53 +01:00
parent 832efbcdd8
commit 2af00da482
2 changed files with 5 additions and 5 deletions

View file

@ -1,7 +1,7 @@
{-# LANGUAGE LambdaCase #-} {-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
module Codegen.Codegen (compile) where module Codegen.Codegen (generateCode) where
import Auxiliary (snoc) import Auxiliary (snoc)
import Codegen.LlvmIr (CallingConvention (..), LLVMComp (..), import Codegen.LlvmIr (CallingConvention (..), LLVMComp (..),
@ -131,8 +131,8 @@ test v = Program [
An easy way to actually "compile" this output is to An easy way to actually "compile" this output is to
Simply pipe it to LLI Simply pipe it to LLI
-} -}
compile :: Program -> Err String generateCode :: Program -> Err String
compile (Program scs) = do generateCode (Program scs) = do
let codegen = initCodeGenerator scs let codegen = initCodeGenerator scs
llvmIrToString . instructions <$> execStateT (compileScs scs) codegen llvmIrToString . instructions <$> execStateT (compileScs scs) codegen

View file

@ -2,7 +2,7 @@
module Main where module Main where
import Codegen.Codegen (compile) import Codegen.Codegen (generateCode)
import GHC.IO.Handle.Text (hPutStrLn) import GHC.IO.Handle.Text (hPutStrLn)
import Grammar.ErrM (Err) import Grammar.ErrM (Err)
import Grammar.Par (myLexer, pProgram) import Grammar.Par (myLexer, pProgram)
@ -51,7 +51,7 @@ main' debug s = do
printToErr $ printTree lifted printToErr $ printTree lifted
printToErr "\n -- Printing compiler output to stdout --" printToErr "\n -- Printing compiler output to stdout --"
compiled <- fromCompilerErr $ compile lifted compiled <- fromCompilerErr $ generateCode lifted
--putStrLn compiled --putStrLn compiled
check <- doesPathExist "output" check <- doesPathExist "output"