“Hayroll: A Modular Wrapper for Translating C Macros and Conditional Compilation to Rust” by Haoran Peng, Baris Kasikci, Gilbert Bernstein, and Michael D. Ernst. In PLDI 2026: Proceedings of the ACM SIGPLAN 2026 Conference on Programming Language Design and Implementation, (Boulder, CO, USA), June 2026.
Existing C-to-Rust translators preprocess their input before translation, discarding macro structure and configurability. As a result, they are incomplete on configurable software and lose programmer-defined abstractions embedded in C macros.
We present Hayroll, a modular wrapper that makes C-to-Rust translation preprocessor-aware without modifying the underlying translator. Hayroll consists of two cooperating layers. The conditional compilation translation layer uses symbolic execution to derive activation conditions for each line of the source code and splits the program into a set of configuration-specific translation tasks. These tasks are then passed independently to the macro translation layer, which classifies macros, annotates macro-expanded nodes with in-AST tags, sends the code through the underlying translator, and later reconstructs them in Rust by retrieving these tags from the translator's output. Because the layers communicate only through task partitioning and in-AST annotations, the underlying translator remains a black box; no invasive changes are required. Our implementation uses C2Rust, but the design is translator-agnostic.
Evaluated on CRUST-Bench, LibmCS, and zlib, Hayroll preserves correctness across configurations, successfully reconstructs most syntactical macros, and avoids configuration explosion through symbolic execution. These results show that decoupled preprocessor analysis can restore configurability and abstraction to C-to-Rust translation in a practical and modular way.
BibTeX entry:
@inproceedings{PengKBE2026,
author = {Haoran Peng and Baris Kasikci and Gilbert Bernstein and
Michael D. Ernst},
title = {Hayroll: A Modular Wrapper for Translating {C} Macros and
Conditional Compilation to {R}ust},
booktitle = {PLDI 2026: Proceedings of the {ACM} {SIGPLAN} 2026
Conference on Programming Language Design and Implementation},
address = {Boulder, CO, USA},
month = jun,
year = {2026}
}
(This webpage was created with bibtex2web.)
Back to Michael Ernst's publications.