An alternative to CPP
summary
Proposal implements a GHC builtin minimal CPP replacement that only supports conditional compilation, integrates into the lexer/parser pipeline, and aims to be tooling friendly and round‑trippable with exact‑print. It parses directives as tokens, evaluates simple operators (and/or/not, <, >), omits include files, and processes only directives in column 1 to avoid label conflicts. Disabled branches become comments so edits preserve layout, turns disabled lines into comments, and a Hackage run shows 508 failures (0.25% of 204k)—targeting ~90% coverage.
AI-written summary · about
chapters (13)
- 0:00Intro
- 0:24What is CPP
- 1:17CPP in Cabal
- 2:09Why is CPP a problem
- 3:47The problem with CPP
- 4:21The alternative
- 5:28Goals
- 7:08Implementation
- 8:20Compliance
- 9:20Usage
- 12:12Line pragmas
- 13:07Code modification
- 20:49Experience report
related talks
40mType-safe Nanopasses: How to write a safe and modern compiler front-end
01h 05mAdvancing cppfront with Modern C++: Refining the Implementation of is, as, and UFCS
31mPfComp: A Verified Compiler for Packet Filtering Leveraging Binary Decision Diagr...
15mMy Journey in Secure Compilation
01h 01mExpressive Compile Time Parsers
15mStaged Selective Parser Combinators
26mHot Call-Chain Inlining for the Glasgow Haskell Compiler
01h 38mGHC Core Optimisations
