Caw is a project aimed at bringing Rust's powerful memory safety guarantees—specifically the Borrow Checker—to the C programming language.
Modern C development is plagued by memory safety issues such as use-after-free, double-free, and data races. Rust solved these problems through ownership and borrowing. Caw aims to replicate this functionality for C, providing a static analysis tool that can verify ownership semantics and enforce safety rules without the overhead of a garbage collector.
Watch the making of this project on YouTube: YouTube
The project is in its early stages. Currently, it features:
- C Parser: A custom-built recursive descent parser (implemented in Rust) capable of tokenizing and parsing C structures including functions, control flow (
if,while,for), and expressions. - Static Analysis Engine: Enforces ownership rules and detects unused variables to prevent memory safety issues and clean up code.
- CLI Interface: A user-friendly command-line interface (powered by
clap) to validate.cfiles.
- Initial C Lexer and Parser implementation.
- Support for more complex C syntax (structs, pointers, etc.).
- Static analysis engine for tracking ownership.
- Lifetime inference for C variables.
- Integration with build systems.
To parse a C file:
cargo run -- --file your_file.cI am in the early stages of development and I'm open to contributions from those interested in compilers, static analysis, and systems safety.
