CompilerEnv.hs 1.57 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
{- |
    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.
-}
Björn Peemöller 's avatar
Björn Peemöller committed
14
15
16
17
18
module CompilerEnv where

import Curry.Base.Ident (ModuleIdent)

import Env.Eval
Björn Peemöller 's avatar
Björn Peemöller committed
19
import Env.Interface
Björn Peemöller 's avatar
Björn Peemöller committed
20
import Env.Label
Björn Peemöller 's avatar
Björn Peemöller committed
21
import Env.ModuleAlias
Björn Peemöller 's avatar
Björn Peemöller committed
22
23
24
25
import Env.OpPrec
import Env.TypeConstructors
import Env.Value

Björn Peemöller 's avatar
Björn Peemöller committed
26
27
28
-- |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
29
data CompilerEnv = CompilerEnv
Björn Peemöller 's avatar
Björn Peemöller committed
30
31
32
33
34
35
  { moduleIdent  :: ModuleIdent  -- ^ identifier of the module
  , aliasEnv     :: AliasEnv     -- ^ aliases for imported modules
  , evalAnnotEnv :: EvalEnv      -- ^ evaluation annotations
  , interfaceEnv :: InterfaceEnv -- ^ declarations of imported interfaces
  , opPrecEnv    :: PEnv         -- ^ operator precedences
  , tyConsEnv    :: TCEnv        -- ^ type constructors
Björn Peemöller 's avatar
Björn Peemöller committed
36
  , valueEnv     :: ValueEnv     -- ^ functions and data constructors
37
  } deriving Show
Björn Peemöller 's avatar
Björn Peemöller committed
38
39
40
41

initCompilerEnv :: ModuleIdent -> CompilerEnv
initCompilerEnv mid = CompilerEnv
  { moduleIdent  = mid
42
  , aliasEnv     = initAliasEnv
Björn Peemöller 's avatar
Björn Peemöller committed
43
  , evalAnnotEnv = initEEnv
Björn Peemöller 's avatar
Björn Peemöller committed
44
  , interfaceEnv = initInterfaceEnv
Björn Peemöller 's avatar
Björn Peemöller committed
45
46
47
48
  , opPrecEnv    = initPEnv
  , tyConsEnv    = initTCEnv
  , valueEnv     = initDCEnv
  }