Score
Writing low-level software involves using languages like C, C++, or Rust to implement OS kernels, device drivers, runtime libraries, or performance-critical components, dealing with concurrency, memory management, system calls, ABI/Linker behavior, and cross-compilation.
This survey addresses core challenges in code generation for low-resource programming languages (LRPLs) and domain-specific languages (DSLs): severe data scarcity, pronounced syntactic specificity, and inadequate coverage by general-purpose pretraining corpora. We systematically analyze 111 studies published between 2020 and 2024. Methodologically, we propose the first dedicated survey framework for LRPLs/DSLs, categorizing evaluation techniques into four types, performance-enhancement methods into six classes, and identifying emerging adaptation architectures; we further pinpoint the critical absence of standardized benchmarks. Through bibliometric analysis, cross-lingual capability assessment, dataset strategy dissection, and comparative evaluation using multidimensional quality metrics—including CodeBLEU and functional correctness—we empirically delineate the capabilities and limitations of mainstream models (e.g., Codex, CodeLlama). Our contributions include a reusable methodological taxonomy and a practical guideline, establishing foundational support for standardization and future research in LRPL/DSL code generation.
To address the “lazy omission” problem—structural omission of numerous target functions—and insufficient safety guarantees exhibited by large language models (LLMs) in migrating large C codebases (e.g., the Linux kernel) to Rust, this paper proposes the first function-granularity, call-graph-constrained LLM-assisted migration framework. Our method integrates context-preserving static analysis, GPT-4o–based code generation, compiler feedback–driven iterative repair, and program synthesis–enabled correction, ensuring interface consistency, memory safety, and idiomatic Rust style. Evaluated on three Linux kernel modules—math, sort, and ramfs—the framework achieves high-fidelity translation requiring less than 15% manual edits to target code. It significantly outperforms end-to-end LLM baselines and, for the first time, systematically resolves structural omissions in system-level C-to-Rust migration.
This study systematically evaluates whether Rust can compete with C in performance and resource efficiency for microcontroller firmware development and assesses its industrial viability. Two teams independently implemented identical industrial IoT firmware—one in Rust and the other in C—and key metrics including development effort, memory footprint, and execution speed were compared on real hardware. This work presents the first systematic comparison of the two languages in a genuine industrial context and introduces Ariel OS, a lightweight Rust-based runtime. Empirical results demonstrate that Rust matches or exceeds C in both resource utilization and execution performance, while Ariel OS exhibits a smaller binary footprint, collectively establishing Rust as a reliable and competitive choice for microcontroller firmware development.
To address memory-safety vulnerabilities inherent in C-based component-based development (CBD) for embedded systems, this paper proposes TECS/Rust—a novel framework that integrates Rust’s compile-time memory-safety mechanisms (lifetime tracking and borrow checking) into the lightweight embedded component specification TECS for the first time, thereby unifying memory safety with component modularity and flexibility. The framework supports automatic code generation for Rust components and enables efficient integration with mainstream real-time operating systems (RTOS). Experimental evaluation demonstrates that TECS/Rust achieves strong memory safety without compromising performance: generated code constitutes a high proportion of the final binary, and runtime overhead is negligible—introducing less than 1% performance degradation compared to conventional C implementations. These results validate TECS/Rust’s capability to jointly optimize safety and efficiency under stringent real-time constraints.
Rust’s static memory safety guarantees can be violated during foreign function interface (FFI) interactions due to aliasing model incompatibilities—particularly with Tree Borrows—leading to undefined behavior (UB) that existing dynamic analysis tools like Miri cannot detect, creating a critical correctness gap in cross-language interoperability. Method: We conduct the first large-scale empirical study across 37 widely used Rust crates, combining Miri with the LLVM interpreter to enable cross-language cooperative analysis and systematically verify FFI call compliance under the Tree Borrows model. Contribution/Results: Our analysis uncovers 46 instances of UB or unexpected behavior—including in three high-download crates and one officially maintained Rust library—demonstrating that while Tree Borrows relaxes aliasing constraints, it exposes severe blind spots in current tooling for FFI contexts. This work establishes a novel methodology and an empirically grounded benchmark for verifying Rust’s cross-language memory safety.
To address pervasive compilation failures, residual unsafe code, and semantic distortion in LLM-driven C-to-Rust translation, this paper proposes the first end-to-end compilable translation framework. Our method comprises three core innovations: (1) structure-aligned preprocessing to harmonize C and Rust abstract syntax tree (AST) hierarchies; (2) context-aware dynamic chunking to overcome LLM context-window limitations; and (3) a compiler-feedback-driven iterative repair mechanism that closes the loop of error localization → prompt rewriting → re-generation. Evaluated on 20 benchmark C programs (>4k LOC total), our approach achieves a 100% Rust compilation success rate, preserves all functional modules without loss, and significantly reduces unsafe code usage. To the best of our knowledge, this is the first work enabling fully automated, high-fidelity migration of large-scale legacy C codebases to memory-safe Rust.
Existing LLM-based project-level C-to-Rust translation approaches lack global pointer semantics understanding, hindering memory safety guarantees. To address this, we propose the first knowledge graph—C-Rust KG—that jointly models pointer semantics and Rust’s ownership model. It explicitly encodes global pointer flows, borrowing relationships, and lifetime constraints, and integrates them into both code dependency graphs and LLM prompt engineering to form a semantics-enhanced cross-language translation framework. This enables LLMs to generate idiomatic, memory-safe Rust code consistently within full-project context. Experimental evaluation shows our method reduces unsafe code by 99.9% and improves functional correctness by 29.3% on average, significantly outperforming both rule-based systems and state-of-the-art LLM-only approaches.
This work addresses the inefficiency, high error rates, and limited flexibility of existing rule-based approaches for automatically translating legacy C/C++ systems into memory-safe Rust code. To overcome these challenges, we propose a retrieval-augmented generation (RAG) framework that synergistically combines large language models (LLMs) with small language models (SLMs). Our method employs a source code chunking strategy and leverages Rust’s official documentation and compiler error messages as retrieval contexts to enable context-aware translation. Experimental evaluation on multiple Coreutils programs demonstrates that our approach successfully eliminates raw pointer dereferences (RPDs) and unsafe type casts (UTCs), significantly improving the correctness, memory safety, and automation level of the translation process.
This work addresses the longstanding tension in systems programming languages between physical transparency and compile-time memory safety: C++ lacks enforced safety boundaries, while Rust imposes high cognitive overhead through complex lifetime annotations. To reconcile these concerns, we propose and implement Toka, a novel language featuring an innovative Handle-Soul dual model that syntactically decouples pointer identities (Handles) from their underlying values (Souls), thereby eliminating semantic ambiguity between pointers and values. This design explicitly encodes resource semantics—supporting unique, shared, borrowed, and raw resource modes—and integrates them with compile-time lifetime checking. As a result, Toka significantly reduces the cognitive burden and annotation complexity of memory-safe programming while preserving near-zero runtime overhead and minimal binary size.
Automatically migrating C systems software to Rust faces significant challenges at the interface level, where satisfying Rust’s ownership and borrowing rules is difficult due to the lack of correct and precise translation methods. This work proposes the first constraint-solving–based approach that jointly models semantic equivalence and type correctness—including Rust’s borrow checker constraints—to establish a precise mapping between C and Rust type systems. The method generates minimal-overhead foreign function interface declarations that are directly usable by safe Rust code. Supporting modular and incremental migration, it produces state-of-the-art Rust interfaces for real-world C programs, substantially improving translation quality. However, support for certain C language features and scalability to very large codebases remains an area for future improvement.