Changes between Version 21 and Version 22 of Commentary/Compiler/HscMain


Ignore:
Timestamp:
Oct 4, 2006 9:26:15 PM (8 years ago)
Author:
simonpj
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Commentary/Compiler/HscMain

    v21 v22  
    1212   * The '''[wiki:Commentary/Compiler/Renamer renamer]''' transforms this to {{{HsSyn}}} parameterised by '''[wiki:Commentary/Compiler/NameType Name]'''.  To a first appoximation, a {{{Name}}} is a string plus a {{{Unique}}} (number) that uniquely identifies it.  In particular, the renamer associates each identifier with its binding instance and ensures that all occurrences which associate to the same binding instance share a single {{{Unique}}}.[[BR]][[BR]] 
    1313   * The '''typechecker''' transforms this further, to {{{HsSyn}}} parameterised by '''[wiki:Commentary/Compiler/EntityTypes Id]'''.  To a first approximation, an {{{Id}}} is a {{{Name}}} plus a type. In addition, the type-checker converts class declarations to {{{Class}}}es, and type declarations to {{{TyCon}}}s and {{{DataCon}}}s.  And of course, the type-checker deals in {{{Type}}}s and {{{TyVar}}}s. The [wiki:Commentary/Compiler/EntityTypes data types for these entities] ({{{Type}}}, {{{TyCon}}}, {{{Class}}}, {{{Id}}}, {{{TyVar}}}) are pervasive throughout the rest of the compiler. 
     14 
     15 These three passes can all produce discover programmer errors, which are sorted and reported to the user. 
    1416  
    15  * The '''desugarer''' converts from the massive {{{HsSyn}}} type to [wiki:Commentary/Compiler/CoreSynType GHC's intermediate language, CoreSyn].  This Core-language data type is unusually tiny: just eight constructors. 
     17 * The '''desugarer''' ([[GhcFile(compiler/deSugar/Desugar)]]) converts from the massive {{{HsSyn}}} type to [wiki:Commentary/Compiler/CoreSynType GHC's intermediate language, CoreSyn].  This Core-language data type is unusually tiny: just eight constructors. 
    1618   [[BR]][[BR]]  
    1719   This late desugaring is somewhat unusual.  It is much more common to desugar the program before typechecking, or renaming, becuase that presents the renamer and typechecker with a much smaller language to deal with.  However, GHC's organisation means that 
    1820   * error messages can display precisely the syntax that the user wrote; and  
    19    * desugaring is not required to preserve type-inference properties. 
     21   * desugaring is not required to preserve type-inference properties.[[BR]] 
     22  Generally speaking, the desugarer produces user errors or warnings. But it does produce ''some''.  In particular, (a) pattern-match overlap warnings are produced here; and (b) when desugaring Template Haskell code quotations, the desugarer may find that `THSyntax` is not expressive enough.  In that case, we must produce an error ([[GhcFile(compiler/deSugar/DsMeta)]]). 
    2023 
    2124 * The '''SimplCore''' pass ([[GhcFile(simplCore/SimplCore.lhs)]]) is a bunch of Core-to-Core passes that optimise the program; see [http://research.microsoft.com/%7Esimonpj/Papers/comp-by-trans-scp.ps.gz A transformation-based optimiser for Haskell (SCP'98)] for a more-or-less accurate overview.  The main passes are:[[BR]][[BR]]