Towards Macro-Aware C-to-Rust Transpilation (WIP)

The automatic translation of legacy C code to Rust presents significant challenges, particularly in handling preprocessor macros. C macros introduce metaprogramming constructs that operate at the text level, outside of C's syntax tree, making their direct translation to Rust non-trivial. Existing transpilers --- source-to-source compilers --- expand macros before translation, sacrificing their abstraction and reducing code maintainability. In this work, we introduce Oxidize, a macro-aware C-to-Rust transpilation framework that preserves macro semantics by translating C macros into Rust-compatible constructs while selectively expanding only those that interfere with Rust's stricter semantics. We evaluate our techniques on a small-scale study of real-world macros and find that the majority can be safely and idiomatically transpiled without full expansion.

Authors

Institutions

Publication Details

Published
2025-06-13
DOI
https://doi.org/10.1145/3735452.3735535
Citations
1
Primary Topic
VLSI and Analog Circuit Testing
Type
article
Field-Weighted Citation Impact
2.27

Funders

Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

Towards Macro-Aware C-to-Rust Transpilation (WIP)

Ken Hasselmann, Antonio Paolillo, Robbe De Greef, Attilio Discepoli et al.
1 citations
VLSI and Analog Circuit Testing
2.27
article

Towards Macro-Aware C-to-Rust Transpilation (WIP)

Ken Hasselmann, Antonio Paolillo, Robbe De Greef, Attilio Discepoli, Esteban Aguililla Klein, Théo Engels
article en
1 citations

Abstract

The automatic translation of legacy C code to Rust presents significant challenges, particularly in handling preprocessor macros. C macros introduce metaprogramming constructs that operate at the text level, outside of C's syntax tree, making their direct translation to Rust non-trivial. Existing transpilers --- source-to-source compilers --- expand macros before translation, sacrificing their abstraction and reducing code maintainability. In this work, we introduce Oxidize, a macro-aware C-to-Rust transpilation framework that preserves macro semantics by translating C macros into Rust-compatible constructs while selectively expanding only those that interfere with Rust's stricter semantics. We evaluate our techniques on a small-scale study of real-world macros and find that the majority can be safely and idiomatically transpiled without full expansion.

Université Libre de Bruxelles (BE), Vrije Universiteit Brussel (BE), Royal Military Academy (BE)
Department for Environment, Food and Rural Affairs, UK Government
Openalex Percentile: Top 15%
VLSI and Analog Circuit Testing
2.27
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.