Added a function to load the Standard LLVM library at runtime.
This commit is contained in:
parent
8aaf05bf82
commit
fd64a7e669
4 changed files with 19 additions and 3 deletions
|
|
@ -32,6 +32,7 @@ executable language
|
|||
Grammar.Skel
|
||||
Compiler.Compiler
|
||||
Compiler.StandardLLVMLibrary
|
||||
Compiler.TH
|
||||
Interpreter
|
||||
|
||||
hs-source-dirs: src
|
||||
|
|
@ -42,5 +43,6 @@ executable language
|
|||
, containers
|
||||
, either
|
||||
, array
|
||||
, template-haskell
|
||||
|
||||
default-language: GHC2021
|
||||
|
|
|
|||
|
|
@ -1,6 +1,10 @@
|
|||
{-# LANGUAGE TemplateHaskell #-}
|
||||
module Compiler.StandardLLVMLibrary where
|
||||
import Control.Monad
|
||||
import Language.Haskell.TH
|
||||
import Compiler.TH
|
||||
|
||||
-- $(genCurries 8)
|
||||
|
||||
standardLLVMLibrary :: String
|
||||
standardLLVMLibrary = "
|
||||
|
||||
"
|
||||
standardLLVMLibrary = $(includeStr "src/Compiler/standard_library.ll")
|
||||
|
|
|
|||
10
src/Compiler/TH.hs
Normal file
10
src/Compiler/TH.hs
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
{-# LANGUAGE TemplateHaskell #-}
|
||||
module Compiler.TH where
|
||||
import Control.Monad
|
||||
import Language.Haskell.TH
|
||||
import System.IO.Unsafe(unsafePerformIO)
|
||||
|
||||
includeStr :: String -> Q Exp
|
||||
includeStr file = do
|
||||
let res = unsafePerformIO $ readFile file
|
||||
[|res|]
|
||||
Loading…
Add table
Add a link
Reference in a new issue