/ghc-cpp

Parse and evaluate CPP expressions, for use in GHC (maybe)

Primary LanguageHaskellBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

The part for the GHC_CPP extension to actually process the CPP directives.

See the proposal

This is intended to be integrated into GHC itself, and the work is on this branch

The interface to GHC works as follows

  1. A modified lexer recognises and emits two additional token types

    • A prepreocessor directive line
    • A CPP comment (needed for backward compatibility)
  2. We have a preprocessor interposed between the GHC parser and the GHC lexer. This processes the directive lines, and keeps its own state as to whether to pass on or ignore normal tokens.

This part deals with processing the preprocessor directive lines, and providing a state which can answer the question: should this token be ignored or not.