π€ AI Summary
This study addresses the challenge that conventional macro preprocessing expansion during C-to-Rust transpilation leads to the loss of original code abstraction structures and semantic corruption. To overcome this, we propose Oxidize, a system introducing a novel structure-preserving translation mechanism that directly maps C macros to Rust macros to maintain high-level abstractions. Technically, the approach designs a custom intermediate representation (IR) alongside a macro type system, leveraging auxiliary traits and generic conversion macros to achieve precise transpilation. Experimental evaluations across nine real-world C codebases demonstrate that this method delivers high-fidelity transpilation with minimal performance overhead, effectively resolving the longstanding macro handling difficulties inherent in cross-language migration.
π Abstract
This technical report accompanies our EuroSys 2027 paper "Lifting the Preprocessor with Oxidize: Structure-Preserving C-to-Rust Translation" (DOI 10.1145/3842654.3848533). Oxidize is a C-to-Rust translator that retains C macros as Rust macros instead of expanding them away, so that the translated code keeps the abstractions its developers wrote. The report collects material the paper cites but has no room for: the translator's intermediate representation, pass structure and back-end emission; the details of macro typing through helper traits and the generic cast macro; the sources and pinned revisions of the nine evaluated C codebases; the per-codebase macro population and how macros are attributed to classes; a roadmap from structure-preserving translation toward safe Rust; the performance overhead study and its methodology; and the configuration and prompt used for the LLM-based baselines.