Changes between Version 6 and Version 7 of Commentary/Compiler


Ignore:
Timestamp:
Oct 20, 2006 9:55:08 PM (7 years ago)
Author:
simonpj
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Commentary/Compiler

    v6 v7  
    33= GHC Commentary: The Compiler = 
    44 
    5 The compiler itself is written entirely in Haskell, and lives in the many sub-directories of the [[GhcFile(compiler)]] directory.  Here is a block diagram of its top-level structure: 
    6  
    7 [[Image(ghc-top.png)]] 
    8  
    9 == Contents == 
     5The compiler itself is written entirely in Haskell, and lives in the many sub-directories of the [[GhcFile(compiler)]] directory.   
    106 
    117 * [wiki:ModuleDependencies Compiler Module Dependencies] (deals with the arcane mutual recursions among GHC's many data types) 
     
    3329   * [wiki:Commentary/Compiler/Backends/NCG Native code generator] 
    3430 
    35 The GHC API is the interface exported by 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:  
     31== Overall Structure == 
    3632 
    37  * The "one-shot" mode, where GHC compiles each file on the command line separately (eg. {{{ghc -c Foo.hs}}}). This mode is implemented 
    38    directly on top of [wiki:Commentary/Compiler/HscMain HscMain], since it compiles only one file at a time. In fact, this is all that    
    39    GHC consisted of prior to version 5.00 when GHCi and --make were introduced. 
     33Here is a block diagram of its top-level structure: 
     34 
     35[[Image(ghc-top.png)]] 
     36 
     37The part called '''!HscMain''' deals with compiling a single module.  On top of this is built the '''compilation manager''' (in blue) that manages the compilation of multiple modules.  It exports an interface called the '''GHC API'''.  On top of this API are four small front ends: 
    4038 
    4139 * GHCi, the interactive environment, is implemented in [[GhcFile(compiler/ghci/InteractiveUI.hs)]] and sits squarely on top of the GHC 
     
    4745   [[GhcFile(compiler/main/DriverMkDepend.hs)]].  
    4846 
    49 Note that since GHC is packaged as a single binary, all of these front-ends are present, and there is a single command-line interface implemented in [[GhcFile(compiler/main/Main.hs)]]. 
     47 * The "one-shot" mode, where GHC compiles each file on the command line separately (eg. {{{ghc -c Foo.hs}}}). This mode bypasses teh GHC API, and is implemented 
     48   directly on top of [wiki:Commentary/Compiler/HscMain HscMain], since it compiles only one file at a time. In fact, this is all that    
     49   GHC consisted of prior to version 5.00 when GHCi and `--make` were introduced. 
     50 
     51GHC is packaged as a single binary in which all of these front-ends are present, selected by the command-line flags indicated above.  There is a single command-line interface implemented in [[GhcFile(compiler/main/Main.hs)]]. 
     52 
     53In adition, GHC is compiled, without its front ends, as a ''library'' which can be imported by any Haskell program; see [[wiki:Commentary/Compiler/API the GHC API]]. 
     54 
     55  
     56