Generators.hs 2.35 KB
Newer Older
Björn Peemöller 's avatar
Björn Peemöller committed
1 2 3
{- |
    Module      :  $Header$
    Description :  Code generators
4
    Copyright   :  (c) 2011        Björn Peemöller
5
                       2017        Finn Teegen
Kai-Oliver Prott's avatar
Kai-Oliver Prott committed
6
                       2018        Kai-Oliver Prott
7
    License     :  BSD-3-clause
Björn Peemöller 's avatar
Björn Peemöller committed
8

Kai-Oliver Prott's avatar
Kai-Oliver Prott committed
9
    Maintainer  :  fte@informatik.uni-kiel.de
Björn Peemöller 's avatar
Björn Peemöller committed
10 11 12 13 14
    Stability   :  experimental
    Portability :  portable

    This module subsumes the different code generators.
-}
Björn Peemöller 's avatar
Björn Peemöller committed
15 16
module Generators where

17 18 19 20 21 22 23 24 25 26 27 28 29
import qualified Curry.AbstractCurry            as AC   (CurryProg)
import qualified Curry.FlatCurry.Type           as FC   (Prog, TypeExpr)
import qualified Curry.FlatCurry.Annotated.Type as AFC  (AProg)
import qualified Curry.FlatCurry.Typed.Type     as TFC  (TProg)
import qualified Curry.Syntax                   as CS   (Module)

import qualified Generators.GenAbstractCurry    as GAC   (genAbstractCurry)
import qualified Generators.GenFlatCurry        as GFC   ( genFlatCurry
                                                           , genFlatInterface
                                                           )
import qualified Generators.GenTypeAnnotatedFlatCurry
                                                as GTAFC (genTypeAnnotatedFlatCurry)
import qualified Generators.GenTypedFlatCurry   as GTFC  (genTypedFlatCurry)
Björn Peemöller 's avatar
Björn Peemöller committed
30

31
import           Base.Types                          (Type, PredType)
Finn Teegen's avatar
Finn Teegen committed
32

33 34
import           CompilerEnv                         (CompilerEnv (..))
import qualified IL                                  (Module)
Björn Peemöller 's avatar
Björn Peemöller committed
35

36
-- |Generate typed AbstractCurry
37
genTypedAbstractCurry :: CompilerEnv -> CS.Module PredType -> AC.CurryProg
38 39 40
genTypedAbstractCurry = GAC.genAbstractCurry False

-- |Generate untyped AbstractCurry
41
genUntypedAbstractCurry :: CompilerEnv -> CS.Module PredType -> AC.CurryProg
42
genUntypedAbstractCurry = GAC.genAbstractCurry True
Björn Peemöller 's avatar
Björn Peemöller committed
43

44 45
-- |Generate typed FlatCurry
genTypedFlatCurry :: CompilerEnv -> CS.Module Type -> IL.Module
46
                  -> TFC.TProg
47
genTypedFlatCurry = GTFC.genTypedFlatCurry
48

49 50 51 52 53
-- |Generate type-annotated FlatCurry
genTypeAnnotatedFlatCurry :: CompilerEnv -> CS.Module Type -> IL.Module
                          -> AFC.AProg FC.TypeExpr
genTypeAnnotatedFlatCurry = GTAFC.genTypeAnnotatedFlatCurry

Björn Peemöller 's avatar
Björn Peemöller committed
54
-- |Generate FlatCurry
55
genFlatCurry :: TFC.TProg -> FC.Prog
56
genFlatCurry = GFC.genFlatCurry
Björn Peemöller 's avatar
Björn Peemöller committed
57

Björn Peemöller 's avatar
Björn Peemöller committed
58
-- |Generate a FlatCurry interface
59
genFlatInterface :: FC.Prog -> FC.Prog
60
genFlatInterface = GFC.genFlatInterface