Coccinelle for Rust progress report
10 months ago
- #program transformation
- #CoccinelleForRust
- #Rust
- CoccinelleForRust project progress shared by Tathagata Roy in collaboration with Inria and sponsored by Collabora.
- Coccinelle is a tool for automatic program matching and transformation, originally for C code, now being adapted for Rust.
- Example provided of a semantic patch to automate tedious code updates in Rust, replacing `expression.type_of(impl_id)` with `expression.type_of(impl_id).subst_identity()`.
- Complexity increases with function signature changes and related calls, demonstrated with a semantic patch example.
- Computational Tree Logic (CTL) is central to Coccinelle, adapted for Rust with minor changes from the C version.
- Rust's expression-dominated nature makes matching and transformation more computationally intensive, leading to optimizations like using `RefCell`s and hash tables.
- SmPL parser development leverages Rust Analyzer for parsing Rust constructs, focusing on custom syntax like ellipses and disjunctions.
- Challenges with transforming macros due to their non-standard nature, supporting only function-like macros.
- Current focus is on matching Coccinelle For Rust's functionalities with Coccinelle For C, with ongoing work on pretty printing and other features.
- CoccinelleForRust is available on Gitlab, with an invitation for feedback and questions.