Optimizing Type Migration for LLM-Based C-to-Rust Translation: A Data Flow Graph Approach
summary
Manual translation of the Gzip C package using LLMs and static analysis documents concrete fixes: extract data flow graphs with CLAN, prompt o1/ChatGPT01 to map pointers to Box/Slice/Index based on malloc/indexing/arithmetic, and replace risky globals with enum indicators to avoid multiple mutable borrows. The Rust build passes 64/69 tests, 151 globals and 76 locals are annotated, the method introduces 14 enum indicators, and pointer experiments produce only 2 pointer mistakes while a baseline misclassifies most pointers.
AI-written summary · about
chapters (8)
- 0:00LLM code translation intro
- 1:05Repository-level C-to-Rust challenges
- 2:53Type migration with mutable refs
- 5:45Pointer type migration
- 8:56Data flow graphs for optimization
- 11:04Experimental results and enums
- 12:28Pointer type mapping
- 13:31Gaps and future work
related talks
20mScalable, Validated Code Translation of Entire Projects using Large Language Models
18mChallenges in C++ to Rust Translation with Large Language Models: A Preliminary(…)
34mGood or Bad Vibes? Coding with AI in Rust
36mCode Mending in the AI age
15mInterleaving Large Language Models for Compiler Testing
44mAccelerating Software Development: The LLM (R)evolution
20mStatically Contextualizing Large Language Models with Typed Holes
53mSemantics-based program manipulation in the age of LLMs
