Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Rust
  3. corrode

corrode

GPL-2.0Haskell

An automatic semantics-preserving translator that converts C source code into equivalent Rust syntax.

GitHubGitHub
2.2k stars117 forks0 contributors

What is corrode?

Corrode is an automatic translator that converts C source code into semantically equivalent Rust syntax. It helps developers migrate legacy C codebases to Rust by preserving the original behavior and ABI compatibility, though the output requires manual cleanup to adopt Rust idioms.

Target Audience

Developers and teams maintaining legacy C codebases who want to migrate to Rust incrementally, or those exploring automated translation for research or tooling purposes.

Value Proposition

Corrode provides a reliable, semantics-preserving foundation for C-to-Rust migration, ensuring ABI compatibility and structural fidelity, which reduces manual rewriting effort and maintains link compatibility with existing C binaries.

Overview

C to Rust translator

Use Cases

Best For

  • Incrementally migrating large legacy C codebases to Rust
  • Generating Rust bindings for C libraries with precise semantics
  • Research or education on C and Rust semantics equivalence
  • Automating initial translation steps in C-to-Rust conversion projects
  • Integrating C code into Rust projects while preserving ABI compatibility
  • Testing Rust compilation paths for generated code from C sources

Not Ideal For

  • Projects requiring production-ready, idiomatic Rust code without manual refinement
  • Small C codebases where a full rewrite in Rust would be more time-efficient than translation and cleanup
  • Teams lacking Haskell development environment or unwilling to manage build-from-source dependencies
  • Migrations needing complete C language coverage or support for complex C11/C17 features

Pros & Cons

Pros

Semantics and ABI Preservation

Generates Rust code that behaves identically to the original C if free of undefined behavior, with extern 'C' modifiers ensuring link compatibility with C binaries.

Build System Compatibility

Accepts GCC compiler flags like -I and -D, and includes corrode-cc script to replace gcc in makefiles, enabling seamless integration into existing workflows.

Structural Fidelity

Maintains the original code structure and statement order, making the output recognizable and easier to maintain during migration.

Early Migration Automation

Automates the initial translation step for large legacy codebases, reducing manual rewriting effort while preserving behavior.

Cons

Non-Idiomatic Output

The generated Rust code lacks Rust idioms and safety features, requiring significant manual cleanup—a gap the README acknowledges with plans for a separate 'idiomatic' tool.

Incomplete C Support

The project is in early phases and admits it cannot translate most real C programs, relying on contributions to implement more language features.

Complex Setup Process

No pre-built binaries are available; users must build from source using Haskell tools like Cabal or Stack, which adds overhead and potential environment issues.

Frequently Asked Questions

Quick Stats

Stars2,188
Forks117
Contributors0
Open Issues65
Last commit7 years ago
CreatedSince 2016

Tags

#haskell#build-tools#transpiler#c#c-to-rust#code-migration#rust#legacy-code

Built With

S
Stack
G
GHC
C
Cabal
H
Haskell

Included in

Rust56.6k
Auto-fetched 16 hours ago

Related Projects

c2rustc2rust

Migrate C code to Rust

Stars4,763
Forks307
Last commit21 hours ago
m2cgenm2cgen

Transform ML models into a native code (Java, C, Python, Go, JavaScript, Visual Basic, C#, R, PowerShell, PHP, Dart, Haskell, Ruby, F#, Rust) with zero dependencies

Stars2,994
Forks264
Last commit2 years ago
aleph_ollamaaleph_ollama

Experimental translator source code

Stars3
Forks0
Last commit1 year ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub