diff --git a/DDC/Core/Tetra.hs b/DDC/Core/Tetra.hs
new file mode 100644
--- /dev/null
+++ b/DDC/Core/Tetra.hs
@@ -0,0 +1,21 @@
+
+module DDC.Core.Tetra
+        ( -- * Language profile
+          profile
+
+          -- * Names
+        , Name          (..)
+        , TyConPrim     (..)
+        , OpPrimArith   (..)
+        , OpPrimRef     (..)
+
+          -- * Name Parsing
+        , readName
+
+          -- * Program Lexing
+        , lexModuleString
+        , lexExpString)
+
+where
+import DDC.Core.Tetra.Prim
+import DDC.Core.Tetra.Profile
diff --git a/DDC/Core/Tetra/Compounds.hs b/DDC/Core/Tetra/Compounds.hs
new file mode 100644
--- /dev/null
+++ b/DDC/Core/Tetra/Compounds.hs
@@ -0,0 +1,10 @@
+
+module DDC.Core.Tetra.Compounds
+        ( module DDC.Core.Compounds.Annot
+        , tBool
+        , tNat
+        , tInt
+        , tWord)
+where
+import DDC.Core.Tetra.Prim.TyConPrim
+import DDC.Core.Compounds.Annot
diff --git a/DDC/Core/Tetra/Env.hs b/DDC/Core/Tetra/Env.hs
new file mode 100644
--- /dev/null
+++ b/DDC/Core/Tetra/Env.hs
@@ -0,0 +1,101 @@
+
+module DDC.Core.Tetra.Env
+        ( primDataDefs
+        , primSortEnv
+        , primKindEnv
+        , primTypeEnv)
+where
+import DDC.Core.Tetra.Prim
+import DDC.Core.Tetra.Compounds
+import DDC.Type.DataDef
+import DDC.Type.Exp
+import DDC.Type.Env             (Env)
+import qualified DDC.Type.Env   as Env
+
+
+-- DataDefs -------------------------------------------------------------------
+-- | Data type definitions 
+--
+-- >  Type                         Constructors
+-- >  ----                ------------------------------
+-- >  Bool                True False
+-- >  Nat                 0 1 2 ...
+-- >  Int                 ... -2i -1i 0i 1i 2i ...
+-- >  Word{8,16,32,64}#   42w8 123w64 ...
+-- 
+primDataDefs :: DataDefs Name
+primDataDefs
+ = fromListDataDefs
+        -- Primitive -----------------------------------------------
+        -- Bool
+        [ DataDef (NameTyConPrim TyConPrimBool) 
+                [] 
+                (Just   [ (NameLitBool True,  []) 
+                        , (NameLitBool False, []) ])
+
+        -- Nat
+        , DataDef (NameTyConPrim TyConPrimNat)  [] Nothing
+
+        -- Int
+        , DataDef (NameTyConPrim TyConPrimInt)  [] Nothing
+
+        -- WordN
+        , DataDef (NameTyConPrim (TyConPrimWord 64)) [] Nothing
+        , DataDef (NameTyConPrim (TyConPrimWord 32)) [] Nothing
+        , DataDef (NameTyConPrim (TyConPrimWord 16)) [] Nothing
+        , DataDef (NameTyConPrim (TyConPrimWord 8))  [] Nothing
+
+        -- Ref
+        , DataDef (NameTyConPrim TyConPrimRef) [] Nothing
+        ]
+
+
+-- Sorts ---------------------------------------------------------------------
+-- | Sort environment containing sorts of primitive kinds.
+primSortEnv :: Env Name
+primSortEnv  = Env.setPrimFun sortOfPrimName Env.empty
+
+
+-- | Take the sort of a primitive kind name.
+sortOfPrimName :: Name -> Maybe (Sort Name)
+sortOfPrimName _ = Nothing
+
+
+-- Kinds ----------------------------------------------------------------------
+-- | Kind environment containing kinds of primitive data types.
+primKindEnv :: Env Name
+primKindEnv = Env.setPrimFun kindOfPrimName Env.empty
+
+
+-- | Take the kind of a primitive name.
+--
+--   Returns `Nothing` if the name isn't primitive. 
+--
+kindOfPrimName :: Name -> Maybe (Kind Name)
+kindOfPrimName nn
+ = case nn of
+        NameTyConPrim tc        -> Just $ kindTyConPrim tc
+        _                       -> Nothing
+
+
+-- Types ----------------------------------------------------------------------
+-- | Type environment containing types of primitive operators.
+primTypeEnv :: Env Name
+primTypeEnv = Env.setPrimFun typeOfPrimName Env.empty
+
+
+-- | Take the type of a name,
+--   or `Nothing` if this is not a value name.
+typeOfPrimName :: Name -> Maybe (Type Name)
+typeOfPrimName dc
+ = case dc of
+        NameOpPrimArith p       -> Just $ typeOpPrimArith p
+        NameOpPrimRef   p       -> Just $ typeOpPrimRef   p
+
+        NameLitBool _           -> Just $ tBool
+        NameLitNat  _           -> Just $ tNat
+        NameLitInt  _           -> Just $ tInt
+        NameLitWord _ bits      -> Just $ tWord bits
+
+        _                       -> Nothing
+
diff --git a/DDC/Core/Tetra/Prim.hs b/DDC/Core/Tetra/Prim.hs
new file mode 100644
--- /dev/null
+++ b/DDC/Core/Tetra/Prim.hs
@@ -0,0 +1,107 @@
+
+module DDC.Core.Tetra.Prim
+        ( -- * Names and lexing.
+          Name          (..)
+        , readName
+
+          -- * Primitive type constructors.
+        , TyConPrim     (..)
+        , kindTyConPrim
+
+          -- * Primitive arithmetic operators.
+        , OpPrimArith   (..)
+        , typeOpPrimArith
+
+          -- * Mutable references.
+        , OpPrimRef     (..)
+        , typeOpPrimRef)
+where
+import DDC.Core.Tetra.Prim.Base
+import DDC.Core.Tetra.Prim.TyConPrim
+import DDC.Core.Tetra.Prim.OpPrimArith
+import DDC.Core.Tetra.Prim.OpPrimRef
+import DDC.Core.Salt.Name 
+        ( readLitPrimNat
+        , readLitPrimInt
+        , readLitPrimWordOfBits)
+
+import DDC.Base.Pretty
+import Control.DeepSeq
+import Data.Char        
+
+
+instance NFData Name where
+ rnf nn
+  = case nn of
+        NameVar s               -> rnf s
+        NameCon s               -> rnf s
+
+        NameTyConPrim con       -> rnf con
+        NameOpPrimArith con     -> rnf con
+        NameOpPrimRef   con     -> rnf con
+
+        NameLitBool b           -> rnf b
+        NameLitNat  n           -> rnf n
+        NameLitInt  i           -> rnf i
+        NameLitWord i bits      -> rnf i `seq` rnf bits
+
+
+instance Pretty Name where
+ ppr nn
+  = case nn of
+        NameVar  v              -> text v
+        NameCon  c              -> text c
+
+        NameTyConPrim tc        -> ppr tc
+        NameOpPrimArith op      -> ppr op
+        NameOpPrimRef   op      -> ppr op
+
+        NameLitBool True        -> text "True"
+        NameLitBool False       -> text "False"
+        NameLitNat  i           -> integer i
+        NameLitInt  i           -> integer i <> text "i"
+        NameLitWord i bits      -> integer i <> text "w" <> int bits
+
+
+-- | Read the name of a variable, constructor or literal.
+readName :: String -> Maybe Name
+readName str
+        -- Primitive names.
+        | Just p <- readTyConPrim   str  
+        = Just $ NameTyConPrim p
+
+        | Just p <- readOpPrimArith str  
+        = Just $ NameOpPrimArith p
+
+        | Just p <- readOpPrimRef   str  
+        = Just $ NameOpPrimRef p
+
+        -- Literal Bools
+        | str == "True"  = Just $ NameLitBool True
+        | str == "False" = Just $ NameLitBool False
+
+        -- Literal Nat
+        | Just val <- readLitPrimNat str
+        = Just $ NameLitNat  val
+
+        -- Literal Ints
+        | Just val <- readLitPrimInt str
+        = Just $ NameLitInt  val
+
+        -- Literal Words
+        | Just (val, bits) <- readLitPrimWordOfBits str
+        , elem bits [8, 16, 32, 64]
+        = Just $ NameLitWord val bits
+
+        -- Constructors.
+        | c : _         <- str
+        , isUpper c
+        = Just $ NameCon str
+
+        -- Variables.
+        | c : _         <- str
+        , isLower c      
+        = Just $ NameVar str
+
+        | otherwise
+        = Nothing
diff --git a/DDC/Core/Tetra/Prim/Base.hs b/DDC/Core/Tetra/Prim/Base.hs
new file mode 100644
--- /dev/null
+++ b/DDC/Core/Tetra/Prim/Base.hs
@@ -0,0 +1,110 @@
+
+module DDC.Core.Tetra.Prim.Base
+        ( Name          (..)
+        , TyConPrim     (..)
+        , OpPrimArith   (..)
+        , OpPrimRef     (..))
+where
+import Data.Typeable
+
+
+-- | Names of things used in Disciple Core Tetra.
+data Name
+        -- | User defined variables.
+        = NameVar               String
+
+        -- | A user defined constructor.
+        | NameCon               String
+
+        -- Machine primitives ------------------
+        -- | A primitive type constructor.
+        | NameTyConPrim         TyConPrim
+
+        -- | Primitive arithmetic, logic, comparison and bit-wise operators.
+        | NameOpPrimArith       OpPrimArith
+
+        -- | Mutable references.
+        | NameOpPrimRef         OpPrimRef
+
+        -- Literals -----------------------------
+        -- | A boolean literal.
+        | NameLitBool           Bool
+
+        -- | A natural literal.
+        | NameLitNat            Integer
+
+        -- | An integer literal.
+        | NameLitInt            Integer
+
+        -- | A word literal.
+        | NameLitWord           Integer Int
+        deriving (Eq, Ord, Show, Typeable)
+
+
+-- TyConPrim ------------------------------------------------------------------
+-- | Primitive type constructors.
+data TyConPrim
+        -- | @Bool@ unboxed booleans.
+        = TyConPrimBool
+
+        -- | @Nat@ natural numbers.
+        --   Big enough to count every addressable byte in the store.
+        | TyConPrimNat
+
+        -- | @Int@ signed integers.
+        | TyConPrimInt
+
+        -- | @WordN@ machine words of the given width.
+        | TyConPrimWord   Int
+
+        -- | A mutable reference.
+        | TyConPrimRef
+        deriving (Eq, Ord, Show)
+
+
+-- OpPrimArith ----------------------------------------------------------------
+-- | Primitive arithmetic, logic, and comparison opretors.
+--   We expect the backend/machine to be able to implement these directly.
+--
+--   For the Shift Right operator, the type that it is used at determines
+--   whether it is an arithmetic (with sign-extension) or logical
+--   (no sign-extension) shift.
+data OpPrimArith
+        -- numeric
+        = OpPrimArithNeg        -- ^ Negation
+        | OpPrimArithAdd        -- ^ Addition
+        | OpPrimArithSub        -- ^ Subtraction
+        | OpPrimArithMul        -- ^ Multiplication
+        | OpPrimArithDiv        -- ^ Division
+        | OpPrimArithMod        -- ^ Modulus
+        | OpPrimArithRem        -- ^ Remainder
+
+        -- comparison
+        | OpPrimArithEq         -- ^ Equality
+        | OpPrimArithNeq        -- ^ Negated Equality
+        | OpPrimArithGt         -- ^ Greater Than
+        | OpPrimArithGe         -- ^ Greater Than or Equal
+        | OpPrimArithLt         -- ^ Less Than
+        | OpPrimArithLe         -- ^ Less Than or Equal
+
+        -- boolean
+        | OpPrimArithAnd        -- ^ Boolean And
+        | OpPrimArithOr         -- ^ Boolean Or
+
+        -- bitwise
+        | OpPrimArithShl        -- ^ Shift Left
+        | OpPrimArithShr        -- ^ Shift Right
+        | OpPrimArithBAnd       -- ^ Bit-wise And
+        | OpPrimArithBOr        -- ^ Bit-wise Or
+        | OpPrimArithBXOr       -- ^ Bit-wise eXclusive Or
+        deriving (Eq, Ord, Show)
+
+
+-- OpPrimRef ------------------------------------------------------------------
+-- | Mutable References.
+data OpPrimRef
+        = OpPrimRefAllocRef     -- ^ Allocate a reference.
+        | OpPrimRefReadRef      -- ^ Read a reference.
+        | OpPrimRefWriteRef     -- ^ Write to a reference.
+        deriving (Eq, Ord, Show)
+
diff --git a/DDC/Core/Tetra/Prim/OpPrimArith.hs b/DDC/Core/Tetra/Prim/OpPrimArith.hs
new file mode 100644
--- /dev/null
+++ b/DDC/Core/Tetra/Prim/OpPrimArith.hs
@@ -0,0 +1,88 @@
+
+module DDC.Core.Tetra.Prim.OpPrimArith
+        ( readOpPrimArith
+        , typeOpPrimArith)
+where
+import DDC.Core.Tetra.Prim.TyConPrim
+import DDC.Core.Tetra.Prim.Base
+import DDC.Type.Compounds
+import DDC.Type.Exp
+import DDC.Base.Pretty
+import Control.DeepSeq
+import Data.List
+
+
+-- OpPrimArith ----------------------------------------------------------------
+instance NFData OpPrimArith
+
+instance Pretty OpPrimArith where
+ ppr op
+  = let Just (_, n) = find (\(p, _) -> op == p) opPrimArithNames
+    in  (text n)
+
+
+-- | Read a primitive operator.
+readOpPrimArith :: String -> Maybe OpPrimArith
+readOpPrimArith str
+  =  case find (\(_, n) -> str == n) opPrimArithNames of
+        Just (p, _)     -> Just p
+        _               -> Nothing
+
+
+-- | Names of primitve operators.
+opPrimArithNames :: [(OpPrimArith, String)]
+opPrimArithNames
+ =      [ (OpPrimArithNeg,        "neg#")
+        , (OpPrimArithAdd,        "add#")
+        , (OpPrimArithSub,        "sub#")
+        , (OpPrimArithMul,        "mul#")
+        , (OpPrimArithDiv,        "div#")
+        , (OpPrimArithRem,        "rem#")
+        , (OpPrimArithMod,        "mod#")
+        , (OpPrimArithEq ,        "eq#" )
+        , (OpPrimArithNeq,        "neq#")
+        , (OpPrimArithGt ,        "gt#" )
+        , (OpPrimArithGe ,        "ge#" )
+        , (OpPrimArithLt ,        "lt#" )
+        , (OpPrimArithLe ,        "le#" )
+        , (OpPrimArithAnd,        "and#")
+        , (OpPrimArithOr ,        "or#" ) 
+        , (OpPrimArithShl,        "shl#")
+        , (OpPrimArithShr,        "shr#")
+        , (OpPrimArithBAnd,       "band#")
+        , (OpPrimArithBOr,        "bor#")
+        , (OpPrimArithBXOr,       "bxor#") ]
+
+
+-- | Take the type of a primitive arithmetic operator.
+typeOpPrimArith :: OpPrimArith -> Type Name
+typeOpPrimArith op
+ = case op of
+        -- Numeric
+        OpPrimArithNeg  -> tForall kData $ \t -> t `tFunPE` t
+        OpPrimArithAdd  -> tForall kData $ \t -> t `tFunPE` t `tFunPE` t
+        OpPrimArithSub  -> tForall kData $ \t -> t `tFunPE` t `tFunPE` t
+        OpPrimArithMul  -> tForall kData $ \t -> t `tFunPE` t `tFunPE` t
+        OpPrimArithDiv  -> tForall kData $ \t -> t `tFunPE` t `tFunPE` t
+        OpPrimArithMod  -> tForall kData $ \t -> t `tFunPE` t `tFunPE` t
+        OpPrimArithRem  -> tForall kData $ \t -> t `tFunPE` t `tFunPE` t
+
+        -- Comparison
+        OpPrimArithEq   -> tForall kData $ \t -> t `tFunPE` t `tFunPE` tBool
+        OpPrimArithNeq  -> tForall kData $ \t -> t `tFunPE` t `tFunPE` tBool
+        OpPrimArithGt   -> tForall kData $ \t -> t `tFunPE` t `tFunPE` tBool
+        OpPrimArithLt   -> tForall kData $ \t -> t `tFunPE` t `tFunPE` tBool
+        OpPrimArithLe   -> tForall kData $ \t -> t `tFunPE` t `tFunPE` tBool
+        OpPrimArithGe   -> tForall kData $ \t -> t `tFunPE` t `tFunPE` tBool
+
+        -- Boolean
+        OpPrimArithAnd  -> tBool `tFunPE` tBool `tFunPE` tBool
+        OpPrimArithOr   -> tBool `tFunPE` tBool `tFunPE` tBool
+
+        -- Bitwise
+        OpPrimArithShl  -> tForall kData $ \t -> t `tFunPE` t `tFunPE` t
+        OpPrimArithShr  -> tForall kData $ \t -> t `tFunPE` t `tFunPE` t
+        OpPrimArithBAnd -> tForall kData $ \t -> t `tFunPE` t `tFunPE` t
+        OpPrimArithBOr  -> tForall kData $ \t -> t `tFunPE` t `tFunPE` t
+        OpPrimArithBXOr -> tForall kData $ \t -> t `tFunPE` t `tFunPE` t
+
diff --git a/DDC/Core/Tetra/Prim/OpPrimRef.hs b/DDC/Core/Tetra/Prim/OpPrimRef.hs
new file mode 100644
--- /dev/null
+++ b/DDC/Core/Tetra/Prim/OpPrimRef.hs
@@ -0,0 +1,57 @@
+
+module DDC.Core.Tetra.Prim.OpPrimRef
+        ( readOpPrimRef
+        , typeOpPrimRef)
+where
+import DDC.Core.Tetra.Prim.TyConPrim
+import DDC.Core.Tetra.Prim.Base
+import DDC.Type.Compounds
+import DDC.Type.Exp
+import DDC.Base.Pretty
+import Control.DeepSeq
+import Data.List
+
+
+-- OpPrimArith ----------------------------------------------------------------
+instance NFData OpPrimRef
+
+instance Pretty OpPrimRef where
+ ppr op
+  = let Just (_, n) = find (\(p, _) -> op == p) opPrimRefNames
+    in  (text n)
+
+
+-- | Read a primitive operator.
+readOpPrimRef :: String -> Maybe OpPrimRef
+readOpPrimRef str
+  =  case find (\(_, n) -> str == n) opPrimRefNames of
+        Just (p, _)     -> Just p
+        _               -> Nothing
+
+
+-- | Names of primitve operators.
+opPrimRefNames :: [(OpPrimRef, String)]
+opPrimRefNames
+ =      [ (OpPrimRefAllocRef,   "allocRef#")
+        , (OpPrimRefReadRef,    "readRef#")
+        , (OpPrimRefWriteRef,   "writeRef#") ]
+
+
+-- | Take the type of a primitive arithmetic operator.
+typeOpPrimRef :: OpPrimRef -> Type Name
+typeOpPrimRef op
+ = case op of
+        OpPrimRefAllocRef  
+         -> tForalls [kRegion, kData] 
+          $ \[tR, tA] -> tA 
+                        `tFun` tSusp (tAlloc tR) (tRef tR tA)
+
+        OpPrimRefReadRef   
+         -> tForalls [kRegion, kData]
+          $ \[tR, tA] -> tRef tR tA
+                        `tFun` tSusp (tRead tR) tA
+
+        OpPrimRefWriteRef  
+         -> tForalls [kRegion, kData]
+         $  \[tR, tA] -> tRef tR tA `tFun` tA
+                        `tFun` tSusp (tWrite tR) tUnit
diff --git a/DDC/Core/Tetra/Prim/TyConPrim.hs b/DDC/Core/Tetra/Prim/TyConPrim.hs
new file mode 100644
--- /dev/null
+++ b/DDC/Core/Tetra/Prim/TyConPrim.hs
@@ -0,0 +1,102 @@
+
+module DDC.Core.Tetra.Prim.TyConPrim 
+        ( TyConPrim     (..)
+        , readTyConPrim
+        , kindTyConPrim
+        , tBool
+        , tNat
+        , tInt
+        , tWord
+        , tRef)
+where
+import DDC.Core.Tetra.Prim.Base
+import DDC.Core.Compounds.Annot
+import DDC.Core.Exp.Simple
+import DDC.Base.Pretty
+import Control.DeepSeq
+import Data.List
+import Data.Char
+
+
+instance NFData TyConPrim where
+ rnf tc
+  = case tc of
+        TyConPrimWord i         -> rnf i
+        _                       -> ()
+
+
+instance Pretty TyConPrim where
+ ppr tc
+  = case tc of
+        TyConPrimBool           -> text "Bool"
+        TyConPrimNat            -> text "Nat"
+        TyConPrimInt            -> text "Int"
+        TyConPrimWord   bits    -> text "Word"  <> int bits
+        TyConPrimRef            -> text "Ref"
+
+
+-- | Read a primitive type constructor.
+--  
+--   Words are limited to 8, 16, 32, or 64 bits.
+--  
+--   Floats are limited to 32 or 64 bits.
+readTyConPrim :: String -> Maybe TyConPrim
+readTyConPrim str
+        | str == "Bool" = Just $ TyConPrimBool
+        | str == "Nat"  = Just $ TyConPrimNat
+        | str == "Int"  = Just $ TyConPrimInt
+
+        -- WordN
+        | Just rest     <- stripPrefix "Word" str
+        , (ds, "")      <- span isDigit rest
+        , not $ null ds
+        , n             <- read ds
+        , elem n [8, 16, 32, 64]
+        = Just $ TyConPrimWord n
+
+        | str == "Ref"  = Just $ TyConPrimRef
+
+        | otherwise
+        = Nothing
+
+
+-- | Yield the kind of a type constructor.
+kindTyConPrim :: TyConPrim -> Kind Name
+kindTyConPrim tc
+ = case tc of
+        TyConPrimBool    -> kData
+        TyConPrimNat     -> kData
+        TyConPrimInt     -> kData
+        TyConPrimWord  _ -> kData
+        TyConPrimRef     -> kRegion `kFun` kData `kFun` kData
+
+
+-- Compounds ------------------------------------------------------------------
+-- | Primitive `Bool` type.
+tBool   :: Type Name
+tBool   = TCon (TyConBound (UPrim (NameTyConPrim TyConPrimBool) kData) kData)
+
+
+-- | Primitive `Nat` type.
+tNat    ::  Type Name
+tNat    = TCon (TyConBound (UPrim (NameTyConPrim TyConPrimNat) kData) kData)
+
+
+-- | Primitive `Int` type.
+tInt    ::  Type Name
+tInt    = TCon (TyConBound (UPrim (NameTyConPrim TyConPrimInt) kData) kData)
+
+
+-- | Primitive `WordN` type of the given width.
+tWord   :: Int -> Type Name
+tWord bits 
+        = TCon (TyConBound (UPrim (NameTyConPrim (TyConPrimWord bits)) kData) kData)
+
+
+-- | Primitive `Ref` type.
+tRef    :: Region Name -> Type Name -> Type Name
+tRef tR tA   
+ = tApps (TCon (TyConBound (UPrim (NameTyConPrim TyConPrimRef) k) k))
+                [tR, tA]
+ where k = kRegion `kFun` kData `kFun` kData
+
diff --git a/DDC/Core/Tetra/Profile.hs b/DDC/Core/Tetra/Profile.hs
new file mode 100644
--- /dev/null
+++ b/DDC/Core/Tetra/Profile.hs
@@ -0,0 +1,98 @@
+
+-- | Language profile for Disciple Core Tetra
+module DDC.Core.Tetra.Profile
+        ( profile
+        , lexModuleString
+        , lexExpString
+        , freshT
+        , freshX)
+where
+import DDC.Core.Tetra.Prim
+import DDC.Core.Tetra.Env
+import DDC.Core.Fragment
+import DDC.Core.Lexer
+import DDC.Type.Exp
+import DDC.Data.Token
+import Control.Monad.State.Strict
+import DDC.Type.Env             (Env)
+import qualified DDC.Type.Env   as Env
+
+-- | Language profile for Disciple Core Flow.
+profile :: Profile Name 
+profile
+        = Profile
+        { profileName                   = "Tetra"
+        , profileFeatures               = features
+        , profilePrimDataDefs           = primDataDefs
+        , profilePrimSupers             = primSortEnv
+        , profilePrimKinds              = primKindEnv
+        , profilePrimTypes              = primTypeEnv
+
+          -- We don't need to distinguish been boxed and unboxed
+          -- because we allow unboxed instantiation.
+        , profileTypeIsUnboxed          = const False }
+
+
+features :: Features
+features 
+        = Features
+        { featuresTrackedEffects        = True
+        , featuresTrackedClosures       = False
+        , featuresFunctionalEffects     = False
+        , featuresFunctionalClosures    = False
+        , featuresPartialPrims          = True
+        , featuresPartialApplication    = True
+        , featuresGeneralApplication    = True
+        , featuresNestedFunctions       = True
+        , featuresDebruijnBinders       = True
+        , featuresUnboundLevel0Vars     = False
+        , featuresUnboxedInstantiation  = True
+        , featuresNameShadowing         = True
+        , featuresUnusedBindings        = True
+        , featuresUnusedMatches         = True }
+
+
+-- | Lex a string to tokens, using primitive names.
+--
+--   The first argument gives the starting source line number.
+lexModuleString :: String -> Int -> String -> [Token (Tok Name)]
+lexModuleString sourceName lineStart str
+ = map rn $ lexModuleWithOffside sourceName lineStart str
+ where rn (Token strTok sp) 
+        = case renameTok readName strTok of
+                Just t' -> Token t' sp
+                Nothing -> Token (KJunk "lexical error") sp
+
+
+-- | Lex a string to tokens, using primitive names.
+--
+--   The first argument gives the starting source line number.
+lexExpString :: String -> Int -> String -> [Token (Tok Name)]
+lexExpString sourceName lineStart str
+ = map rn $ lexExp sourceName lineStart str
+ where rn (Token strTok sp) 
+        = case renameTok readName strTok of
+                Just t' -> Token t' sp
+                Nothing -> Token (KJunk "lexical error") sp
+
+
+-- | Create a new type variable name that is not in the given environment.
+freshT :: Env Name -> Bind Name -> State Int Name
+freshT env bb
+ = do   i       <- get
+        put (i + 1)
+        let n =  NameVar ("t" ++ show i)
+        case Env.lookupName n env of
+         Nothing -> return n
+         _       -> freshT env bb
+
+
+-- | Create a new value variable name that is not in the given environment.
+freshX :: Env Name -> Bind Name -> State Int Name
+freshX env bb
+ = do   i       <- get
+        put (i + 1)
+        let n = NameVar ("x" ++ show i)
+        case Env.lookupName n env of
+         Nothing -> return n
+         _       -> freshX env bb
diff --git a/LICENSE b/LICENSE
new file mode 100644
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,30 @@
+--------------------------------------------------------------------------------
+The Disciplined Disciple Compiler License (MIT style)
+
+Copyrite (K) 2007-2013 The Disciplined Disciple Compiler Strike Force
+All rights reversed.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+-------------------------------------------------------------------------------
+Under Australian law copyright is free and automatic.
+By contributing to DDC authors grant all rights they have regarding their
+contributions to the other members of the Disciplined Disciple Compiler Strike
+Force, past, present and future, as well as placing their contributions under
+the above license.
+
+Use "darcs show authors" to get a list of Strike Force members.
+
+--------------------------------------------------------------------------------
+Redistributions of libraries in ./external are governed by their own licenses:
+
+  - TinyPTC   GNU Lesser General Public License
+  
diff --git a/Setup.hs b/Setup.hs
new file mode 100644
--- /dev/null
+++ b/Setup.hs
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain
diff --git a/ddc-core-tetra.cabal b/ddc-core-tetra.cabal
new file mode 100644
--- /dev/null
+++ b/ddc-core-tetra.cabal
@@ -0,0 +1,59 @@
+Name:           ddc-core-tetra
+Version:        0.3.2.1
+License:        MIT
+License-file:   LICENSE
+Author:         The Disciplined Disciple Compiler Strike Force
+Maintainer:     Ben Lippmeier <benl@ouroborus.net>
+Build-Type:     Simple
+Cabal-Version:  >=1.6
+Stability:      experimental
+Category:       Compilers/Interpreters
+Homepage:       http://disciple.ouroborus.net
+Synopsis:       Disciplined Disciple Compiler intermediate language.
+Description:    Disciplined Disciple Compiler intermediate language
+                with internalized effect judgement.
+
+Library
+  Build-Depends: 
+        base            == 4.6.*,
+        deepseq         == 1.3.*,
+        containers      == 0.5.*,
+        array           == 0.4.*,
+        transformers    == 0.3.*,
+        mtl             == 2.1.*,
+        ddc-base        == 0.3.2.*,
+        ddc-core        == 0.3.2.*,
+        ddc-core-salt   == 0.3.2.*,
+        ddc-core-simpl  == 0.3.2.*
+
+  Exposed-modules:
+        DDC.Core.Tetra
+
+        DDC.Core.Tetra.Compounds
+        DDC.Core.Tetra.Env
+        DDC.Core.Tetra.Prim
+        DDC.Core.Tetra.Profile
+
+  Other-modules:
+        DDC.Core.Tetra.Prim.Base
+        DDC.Core.Tetra.Prim.OpPrimArith
+        DDC.Core.Tetra.Prim.OpPrimRef
+        DDC.Core.Tetra.Prim.TyConPrim
+
+
+  GHC-options:
+        -Wall
+        -fno-warn-orphans
+        -fno-warn-missing-signatures
+        -fno-warn-unused-do-bind
+
+  Extensions:
+        KindSignatures
+        NoMonomorphismRestriction
+        ScopedTypeVariables
+        StandaloneDeriving
+        PatternGuards
+        ParallelListComp
+        DeriveDataTypeable
+        ViewPatterns
+        
