Go to the first, previous, next, last section, table of contents.

Running the right phases in the right order

The basic task of the `ghc' driver is to run each input file through the right phases (parsing, linking, etc.).

The first phase to run is determined by the input-file suffix, and the last phase is determined by a flag. If no relevant flag is present, then go all the way through linking. This table summarises:

phase of the            suffix saying  flag saying   (suffix of)  
compilation system      "start here"   "stop after"  output file  
----------------------------------------------------------------
literate pre-processor  .lhs           -             -            
C pre-processor (opt.)  -              -             -            
Haskell parser          .hs            -             -            
Haskell compiler        -              -C, -S        .hc, .s      
C compiler (opt.)       .hc or .c      -S            .s           
assembler               .s             -c            .o           
linker                  other          -             a.out        

Thus, a common invocation would be: `ghc -c Foo.hs'

Note: What the Haskell compiler proper produces depends on whether a native-code generator is used (producing assembly language) or not (producing C).

The option `-cpp' must be given for the C pre-processor phase to be run.

The option `-E' runs just the C-preprocessor part of the C-compiling phase, sending the result to stdout [I think]. (For debugging, usually.)


Go to the first, previous, next, last section, table of contents.