Automatically translating system software from C to Rust is an appealing but challenging problem, as it requires whole-program reasoning to satisfy Rust's ownership and borrowing discipline. A key enabling step in whole-program translation is interface translation, which produces Rust declarations for the C program's top-level declarations (i.e., structs and function signatures), enabling modular and incremental code translation. This paper introduces correct, precise C-to-Rust interface translation, called &inator. &inator employs a novel constraint-based formulation of semantic equivalence and type correctness including borrow-checking rules to produce a Rust interface that is correct (i.e., the interface admits a semantics-preserving implementation in safe Rust) and precise (i.e., it uses the simplest, least costly types). Our results show &inator produces correct, precise Rust interfaces for real C programs, but support for certain C features and scaling to large programs are challenges left for future work. This work advances the state of the art by being the first correct, precise approach to C-to-Rust interface translation.


翻译:将系统软件从C语言自动翻译为Rust是一个颇具吸引力但充满挑战的问题,因为需要全局程序推理才能满足Rust的所有权和借用规则。在全局程序翻译过程中,接口翻译是关键步骤,它为C程序的顶层声明(即结构体和函数签名)生成Rust声明,从而实现模块化、增量式的代码翻译。本文提出了一种名为&inator的正确、精确的C到Rust接口翻译方法。&inator采用了一种新颖的基于约束的方法,该方法结合了语义等价性、类型正确性(包括借用检查规则)来生成Rust接口,确保接口的正确性(即该接口允许在安全Rust中实现语义保持)和精确性(即使用最简单、成本最低的类型)。实验结果表明,&inator能为真实的C程序生成正确、精确的Rust接口,但对某些C语言特性的支持以及扩展到大型程序仍留待未来工作解决。本工作首次提出了正确且精确的C到Rust接口翻译方法,从而推进了该领域的研究前沿。

0
下载
关闭预览

相关内容

Rust 是一种注重高效、安全、并行的系统程序语言。
端到端语音到语音翻译的优化方法综述
专知会员服务
8+阅读 · 2025年6月10日
【干货书】C++实战编程指南,附549页pdf与Slides
专知会员服务
84+阅读 · 2021年4月23日
【Google】无监督机器翻译,Unsupervised Machine Translation
专知会员服务
36+阅读 · 2020年3月3日
Effective.Modern.C++ 中英文版,334页pdf
专知
26+阅读 · 2020年11月4日
82页《现代C++教程》:高速上手C++ 11/14/17/20
专知
21+阅读 · 2020年10月19日
【翻译技术速递】入门教程:Trados 翻译记忆库工具
翻译技术沙龙
38+阅读 · 2019年11月28日
清华大学:刘洋——基于深度学习的机器翻译
人工智能学家
12+阅读 · 2017年11月13日
神经网络机器翻译原理:LSTM、seq2seq到Zero-Shot
北京思腾合力科技有限公司
11+阅读 · 2017年8月10日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
8+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
VIP会员
最新内容
重新思考无人机时代的生存能力
专知会员服务
2+阅读 · 今天7:44
装甲突击旅:现代战争思考、战斗与组织
专知会员服务
2+阅读 · 今天7:28
在人工智能加速决策环境中拓展OODA循环
专知会员服务
3+阅读 · 今天7:18
军事欺骗:供作战战术指挥官使用的工具
专知会员服务
3+阅读 · 今天7:03
综述 | 世界动作模型:少做梦,多行动
专知会员服务
5+阅读 · 6月23日
美以伊冲突:无人机与人工智能的运用
专知会员服务
10+阅读 · 6月23日
《特种部队在透明战场中的生存力》最新报告
专知会员服务
5+阅读 · 6月23日
相关资讯
相关基金
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
8+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员