CompilerEnv.hs 1.56 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
20
import Env.Interface
import Env.ModuleAlias
Björn Peemöller 's avatar
Björn Peemöller committed
21
22
23
24
import Env.OpPrec
import Env.TypeConstructors
import Env.Value

Björn Peemöller 's avatar
Björn Peemöller committed
25
26
27
-- |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
28
data CompilerEnv = CompilerEnv
Björn Peemöller 's avatar
Björn Peemöller committed
29
30
31
32
33
34
  { 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
35
  , valueEnv     :: ValueEnv     -- ^ functions and data constructors
36
  } deriving Show
Björn Peemöller 's avatar
Björn Peemöller committed
37
38
39
40

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