C preprossor macros from functional programs
summary
Claims a tool that compiles Haskell (via a GHC plugin working on GHC core) into C preprocessor macros, emitting macro definitions into headers and representing source snippets as a token stream type. It handles most pure code, converts local bindings to explicit macro parameters, and implements recursion unrolling limit annotations; higher-order functions get only partial support. The prototype runs on small real examples, lives on GitHub, and yields generated macros about an order of magnitude slower than careful handwritten macro code.
AI-written summary · about
chapters (13)
- 0:00Intro
- 1:48Proposal
- 2:17Demonstration
- 4:29Motivations
- 6:00Architecture
- 7:24Haske definitions
- 8:44Other constructs
- 9:51Pattern matching
- 10:41Issues
- 12:05Token Stream
- 14:04Recursion
- 15:50Higherorder functions
- 17:09Summary
related talks
20mHayroll: A Modular Wrapper for Translating C Macros and Conditional Compilation to Rust
29mMacromancy: an introduction to Rust macros
58mThe Preprocessor: Everything You Need to Know and More!
31mFunctional programming guerilla in the land of Rust
01h 00mTeaching old compilers new tricks
26mMy Little Procedural Macro
24mMacros for a More Productive Rust
28mA gentle introduction to procedural macros
