summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPéter Diviánszky <divipp@gmail.com>2016-01-09 13:31:20 +0100
committerPéter Diviánszky <divipp@gmail.com>2016-01-09 13:31:20 +0100
commitc9373d5b6173c641434e3fa7c53f09b3b88d9161 (patch)
tree69f7a4583afd205a814cd8bf4a2c8424dd58925d /src
parent938bbdd8077e9f22b047b84a2209f55f737790f3 (diff)
refactoring
Diffstat (limited to 'src')
-rw-r--r--src/LambdaCube/Compiler/CGExp.hs6
-rw-r--r--src/LambdaCube/Compiler/Driver.hs6
2 files changed, 7 insertions, 5 deletions
diff --git a/src/LambdaCube/Compiler/CGExp.hs b/src/LambdaCube/Compiler/CGExp.hs
index 21a02e8d..b2f19c9f 100644
--- a/src/LambdaCube/Compiler/CGExp.hs
+++ b/src/LambdaCube/Compiler/CGExp.hs
@@ -214,7 +214,7 @@ pattern TCon0 n = A0 n
214pattern TCon t n = Con (n, t) [] 214pattern TCon t n = Con (n, t) []
215 215
216pattern TUnit <- A0 "Tuple0" 216pattern TUnit <- A0 "Tuple0"
217pattern TBool <- A0 "Bool" 217pattern TBool = A0 "Bool"
218pattern TWord <- A0 "Word" 218pattern TWord <- A0 "Word"
219pattern TInt <- A0 "Int" 219pattern TInt <- A0 "Int"
220pattern TNat = A0 "Nat" 220pattern TNat = A0 "Nat"
@@ -270,3 +270,7 @@ getSwizzChar = \case
270 A0 "Sw" -> Just 'w' 270 A0 "Sw" -> Just 'w'
271 _ -> Nothing 271 _ -> Nothing
272 272
273outputType = TCon0 "Output"
274boolType = TBool
275trueExp = TCon TBool "True"
276
diff --git a/src/LambdaCube/Compiler/Driver.hs b/src/LambdaCube/Compiler/Driver.hs
index 46b25148..68ec34dd 100644
--- a/src/LambdaCube/Compiler/Driver.hs
+++ b/src/LambdaCube/Compiler/Driver.hs
@@ -11,6 +11,7 @@ module LambdaCube.Compiler.Driver
11 , Infos 11 , Infos
12 , showRange 12 , showRange
13 , ErrorMsg(..) 13 , ErrorMsg(..)
14 , Exp
14 ) where 15 ) where
15 16
16import Data.List 17import Data.List
@@ -32,7 +33,7 @@ import Debug.Trace
32 33
33import LambdaCube.Compiler.Pretty hiding ((</>)) 34import LambdaCube.Compiler.Pretty hiding ((</>))
34import LambdaCube.Compiler.Infer (Info, Infos, ErrorMsg(..), showRange, PolyEnv(..), Export(..), ModuleR(..), ErrorT, throwErrorTCM, parseLC, joinPolyEnvs, inference_) 35import LambdaCube.Compiler.Infer (Info, Infos, ErrorMsg(..), showRange, PolyEnv(..), Export(..), ModuleR(..), ErrorT, throwErrorTCM, parseLC, joinPolyEnvs, inference_)
35import LambdaCube.Compiler.CGExp 36import LambdaCube.Compiler.CGExp (Exp, toExp, outputType)
36import IR 37import IR
37import qualified LambdaCube.Compiler.CoreToIR as IR 38import qualified LambdaCube.Compiler.CoreToIR as IR
38 39
@@ -147,9 +148,6 @@ getDef m d ty = do
147 , infos pe 148 , infos pe
148 ) 149 )
149 150
150outputType :: Exp
151outputType = TCon TType "Output"
152
153parseAndToCoreMain m = either (throwErrorTCM . text) return . (\(e, i) -> flip (,) i <$> e) =<< getDef m "main" (Just outputType) 151parseAndToCoreMain m = either (throwErrorTCM . text) return . (\(e, i) -> flip (,) i <$> e) =<< getDef m "main" (Just outputType)
154 152
155compileMain_ :: MonadMask m => PolyEnv -> ModuleFetcher (MMT m) -> IR.Backend -> FilePath -> MName -> m (Err (IR.Pipeline, Infos)) 153compileMain_ :: MonadMask m => PolyEnv -> ModuleFetcher (MMT m) -> IR.Backend -> FilePath -> MName -> m (Err (IR.Pipeline, Infos))