CompilerEnv.hs 1.68 KB
Newer Older
Björn Peemöller 's avatar
Björn Peemöller committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
{- |
    Module      :  $Header$
    Description :  Environment containing the module's information
    Copyright   :  (c) 2011, Björn Peemöller (bjp@informatik.uni-kiel.de)
    License     :  OtherLicense

    Maintainer  :  bjp@informatik.uni-kiel.de
    Stability   :  experimental
    Portability :  portable

    This module defines an environment for a module containing the information
    needed throughout the compilation of the module.
-}

-- TODO: rename to Base.ModuleEnv ?

Björn Peemöller 's avatar
Björn Peemöller committed
17
18
19
20
21
module CompilerEnv where

import Curry.Base.Ident (ModuleIdent)

import Env.Eval
Björn Peemöller 's avatar
Björn Peemöller committed
22
import Env.Interface
Björn Peemöller 's avatar
Björn Peemöller committed
23
import Env.Label
Björn Peemöller 's avatar
Björn Peemöller committed
24
import Env.ModuleAlias
Björn Peemöller 's avatar
Björn Peemöller committed
25
26
27
28
import Env.OpPrec
import Env.TypeConstructors
import Env.Value

Björn Peemöller 's avatar
Björn Peemöller committed
29
30
31
-- |A compiler environment contains information about the module currently
--  compiled. The information is updated during the different stages of
--  compilation.
Björn Peemöller 's avatar
Björn Peemöller committed
32
data CompilerEnv = CompilerEnv
Björn Peemöller 's avatar
Björn Peemöller committed
33
34
35
36
37
38
39
  { moduleIdent  :: ModuleIdent  -- ^ identifier of the module
  , aliasEnv     :: AliasEnv     -- ^ aliases for imported modules
  , evalAnnotEnv :: EvalEnv      -- ^ evaluation annotations
  , interfaceEnv :: InterfaceEnv -- ^ declarations of imported interfaces
  , labelEnv     :: LabelEnv     -- ^ record labels
  , opPrecEnv    :: PEnv         -- ^ operator precedences
  , tyConsEnv    :: TCEnv        -- ^ type constructors
Björn Peemöller 's avatar
Björn Peemöller committed
40
  , valueEnv     :: ValueEnv     -- ^ functions and data constructors
Björn Peemöller 's avatar
Björn Peemöller committed
41
42
43
44
45
  }

initCompilerEnv :: ModuleIdent -> CompilerEnv
initCompilerEnv mid = CompilerEnv
  { moduleIdent  = mid
46
  , aliasEnv     = initAliasEnv
Björn Peemöller 's avatar
Björn Peemöller committed
47
  , evalAnnotEnv = initEEnv
Björn Peemöller 's avatar
Björn Peemöller committed
48
  , interfaceEnv = initInterfaceEnv
Björn Peemöller 's avatar
Björn Peemöller committed
49
  , labelEnv     = initLabelEnv
Björn Peemöller 's avatar
Björn Peemöller committed
50
51
52
53
  , opPrecEnv    = initPEnv
  , tyConsEnv    = initTCEnv
  , valueEnv     = initDCEnv
  }