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
  { moduleIdent  :: ModuleIdent  -- ^ identifier of the module
  , interfaceEnv :: InterfaceEnv -- ^ declarations of imported interfaces
Björn Peemöller 's avatar
Björn Peemöller committed
31
  , aliasEnv     :: AliasEnv     -- ^ aliases for imported modules
Björn Peemöller 's avatar
Björn Peemöller committed
32
  , tyConsEnv    :: TCEnv        -- ^ type constructors
Björn Peemöller 's avatar
Björn Peemöller committed
33
  , valueEnv     :: ValueEnv     -- ^ functions and data constructors
Björn Peemöller 's avatar
Björn Peemöller committed
34
35
  , opPrecEnv    :: PEnv         -- ^ operator precedences
  , evalAnnotEnv :: EvalEnv      -- ^ evaluation annotations
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
Björn Peemöller 's avatar
Björn Peemöller committed
41
  , interfaceEnv = initInterfaceEnv
Björn Peemöller 's avatar
Björn Peemöller committed
42
  , aliasEnv     = initAliasEnv
Björn Peemöller 's avatar
Björn Peemöller committed
43
44
  , tyConsEnv    = initTCEnv
  , valueEnv     = initDCEnv
Björn Peemöller 's avatar
Björn Peemöller committed
45
46
  , opPrecEnv    = initPEnv
  , evalAnnotEnv = initEEnv
Björn Peemöller 's avatar
Björn Peemöller committed
47
  }