Changes between Version 3 and Version 4 of Commentary/Compiler/API


Ignore:
Timestamp:
Sep 11, 2006 11:14:17 AM (9 years ago)
Author:
simonmar
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Commentary/Compiler/API

    v3 v4  
    55This section of the commentary describes everything between [wiki:Commentary/Compiler/HscMain HscMain] and the front-end; that is, the parts of GHC that coordinate the compilation of multiple modules.
    66
     7== Orgainsation of the top of GHC ==
     8
    79[[Image(ghc-top.png)]]
    810
    9 The GHC API is the interface exported by [[GhcFile(compiler/main/GHC.hs)]].  To compile a Haskell module that uses the GHC API, use the flag {{{-package ghc}}} (in GHC 6.6 and later).  GHC itself contains a few front-ends that use the GHC API:
     11The GHC API is the interface exported by [[GhcFile(compiler/main/GHC.hs)]].  To compile a Haskell module that uses the GHC API, use the flag {{{-package ghc}}} (in GHC 6.6 and later).  GHC itself contains a few front-ends:
    1012
    1113 * The "one-shot" mode, where GHC compiles each file on the command line separately (eg. {{{ghc -c Foo.hs}}}).  This mode
    12    is implemented
     14   is implemented directly on top of [wiki:Commentary/Compiler/HscMain HscMain], since it compiles only one file at a
     15   time.  In fact, this is all that GHC consisted of prior to version 5.00 when GHCi and {{{--make}}} were introduced.
    1316
    14  *
     17 * GHCi, the interactive environment, is implemented in [[GhcFile(compiler/ghci/InteractiveUI.hs)]] and sits squarely on top
     18   of the GHC API.
     19
     20 * {{{--make}}} is almost a trivial client of the GHC API, and is implemented in [[GhcFile(compiler/main/Main.hs)]].
     21
     22 * {{{-M}}}, the Makefile dependency generator, is also a client of the GHC API and is implemented in
     23   [[GhcFile(compiler/main/DriverMkDepend.hs)]].
     24
     25Note that since GHC is packaged as a single binary, all of these front-ends are present, and there is a single command-line API.  Everything goes via the {{{main}}} function in [[GhcFile(compiler/main/Main.hs)]].
     26