-
Notifications
You must be signed in to change notification settings - Fork 0
/
Main.hs
24 lines (22 loc) · 814 Bytes
/
Main.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import Compiler.CodeConversion
import Compiler.GenHs
import Compiler.Parser
import Text.Parsec
import Data.Either
import System.Process
main = do
imports <- readFile "Additions/Imports"
typePostfix <- readFile "Additions/TypePostfix"
evalPostfix <- readFile "Additions/EvalPostfix"
mainFn <- readFile "Additions/MainFn"
text <- readFile "main.utlc"
let parsed = parse codeFileParser "main.utlc" text
let frParsed = fromRight (Code0 []) parsed
let converted = imports <> (convCode2Hs typePostfix evalPostfix mainFn $ conv12Code $ conv01Code frParsed) -- TODO jank
if (isRight parsed) then do
writeFile "otp.hs" converted
callCommand "ghc -no-keep-hi-files -no-keep-o-files otp.hs"
callCommand "./otp"
callCommand "rm otp.hs"
callCommand "rm otp"
else print parsed