Hayroll: A Modular Wrapper for Translating C Macros and Conditional Compilation to Rust
summary
Hayroll is a modular wrapper that makes C-to-Rust translators preprocessor-aware without changing them by splitting work into a conditional-compilation layer that uses symbolic execution to compute activation conditions and a macro layer that classifies macros, seeds AST nodes, runs the underlying translator (C2Rust in the implementation), and reconstructs macros from tags. On CRUST-Bench, LibmCS, and zlib it reconstructs over 50% of syntactic macros, preserves configurability, and produces outputs that pass the same tests while running about 500 LOC/s (≈20× slower than plain C2Rust).
AI-written summary · about
chapters (13)
- 0:00Hayroll introduction
- 1:01C macros to Rust challenges
- 3:32Macro translation root causes
- 4:35Hayroll architecture
- 5:16Conditional compilation translation
- 7:04Symbolic execution for compilation
- 8:29Splitting configurable programs
- 9:33Macro translatability analysis
- 10:55Source correspondence problem
- 12:20Macro reconstruction seeding
- 13:45Merging translations
- 14:26Evaluation results
- 16:21Q&A
related talks
28mC2Rust: Migrating Legacy Code to Rust
29mMacromancy: an introduction to Rust macros
13mTowards Macro-Aware C-to-Rust Transpilation (WIP)
58m(Almost) Everything You Should Know About The Compiler Frontend
24mMacros for a More Productive Rust
27mParsing Rust code considered harmful
25m"Eternal Sunshine of the Rustfmt'ed Mind"
32mBuilding and Maintaining Rust at Scale
