Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Typed compiler pipeline!

  • Loading branch information...
commit 2cfeaa35475a9cc7be4bc02b5e3914bb94020757 1 parent 0bb0eee
Sebastiaan Visser authored
View
4 src/Compiler/Raw.hs → src/Compiler/Expr.hs
@@ -5,7 +5,7 @@
, DeriveFoldable
, DeriveTraversable
#-}
-module Compiler.Raw where
+module Compiler.Expr where
import Compiler.Generics
import Control.Monad.State
@@ -13,7 +13,7 @@ import Data.Foldable hiding (elem, mapM_, concatMap, concat, foldr)
import Data.Traversable hiding (mapM)
import Prelude hiding (lookup)
--- Raw value datatype.
+-- Expression datatype.
type Con = String
type Name = String
View
2  src/Compiler/FreeVariables.hs
@@ -10,7 +10,7 @@ module Compiler.FreeVariables
where
import Compiler.Generics
-import Compiler.Raw
+import Compiler.Expr
import Control.Arrow hiding (app)
import Data.List (intercalate)
import Data.Set hiding (map, insert)
View
2  src/Compiler/InstantiateLambdas.hs
@@ -1,7 +1,7 @@
module Compiler.InstantiateLambdas (instantiate, dump) where
import Compiler.Generics
-import Compiler.Raw
+import Compiler.Expr
import Control.Applicative
import Control.Arrow hiding (app)
import Control.Monad.Reader
View
2  src/Compiler/LiftClosedApplications.hs
@@ -3,7 +3,7 @@ module Compiler.LiftClosedApplications (lift) where
import Compiler.FreeVariables (DefinitionsFV, FreeVarA (..))
import Compiler.Generics
import Compiler.LiftDefinitions (DefinitionA (..), DefinitionsA (..), Definition, Definitions)
-import Compiler.Raw
+import Compiler.Expr
import Control.Applicative
import Control.Arrow hiding (app)
import Control.Monad.State hiding (lift)
View
2  src/Compiler/LiftDefinitions.hs
@@ -10,7 +10,7 @@ module Compiler.LiftDefinitions
where
import Compiler.Generics
-import Compiler.Raw
+import Compiler.Expr
import Control.Arrow hiding (app)
import Data.List (intercalate, nubBy)
View
2  src/Compiler/LiftLambdas.hs
@@ -7,7 +7,7 @@ where
import Control.Monad.State
import Control.Applicative
import Compiler.Generics
-import Compiler.Raw
+import Compiler.Expr
import Compiler.FreeVariables
import Control.Arrow hiding (app)
import qualified Data.Set as S
View
17 src/Compiler/Pipeline.hs
@@ -3,17 +3,22 @@ module Compiler.Pipeline where
import Control.Arrow
import Lang.Value (Val)
+import Compiler.Expr
+import Compiler.FreeVariables (DefinitionsFV)
+import Compiler.LiftDefinitions (Definitions)
import qualified Compiler.InstantiateLambdas as Lambdas
import qualified Compiler.FreeVariables as FreeVariables
import qualified Compiler.LiftClosedApplications as ClosedApplications
import qualified Compiler.LiftDefinitions as Definitions
+type a :-> b = Kleisli IO a b
+
compiler :: Val l i -> IO String
compiler = runKleisli
- $ Lambdas.instantiate
- >>> Definitions.lift
- >>> Definitions.eliminiateDoubles
- >>> FreeVariables.annotateDefinitions
- >>> ClosedApplications.lift
- >>> Definitions.dump
+ $ ( Lambdas.instantiate :: Val l i :-> Expr )
+ >>> ( Definitions.lift :: Expr :-> Definitions )
+ >>> ( Definitions.eliminiateDoubles :: Definitions :-> Definitions )
+ >>> ( FreeVariables.annotateDefinitions :: Definitions :-> DefinitionsFV )
+ >>> ( ClosedApplications.lift :: DefinitionsFV :-> Definitions )
+ >>> ( Definitions.dump :: Definitions :-> String )
View
2  src/Compiler/Unused/LambdaLifting.lhs
@@ -4,7 +4,7 @@ First, we will start of with the module header and some imports.
> import Compiler.Generics
> import Control.Arrow hiding (app)
-> import Compiler.Raw
+> import Compiler.Expr
> import qualified Data.Set as S
> import Control.Monad.State
Please sign in to comment.
Something went wrong with that request. Please try again.