Noricum translates your C code to idiomatic Rust using LLM agents, then proves behavioral equivalence by comparing outputs byte-by-byte. If they differ, it fixes itself automatically.
$ git clone https://github.com/JuanMarchetto/noricum
typedef struct cJSON { struct cJSON *next, *prev; struct cJSON *child; int type; char *valuestring; double valuedouble; } cJSON; cJSON *cJSON_Parse(const char *value) { cJSON *c = malloc(sizeof(cJSON)); if (!c) return NULL; memset(c, 0, sizeof(cJSON)); // ... parse, malloc children, // manual linked list management return c; }
enum JsonValue { Null, Bool(bool), Number(f64), Str(String), Array(Vec<JsonValue>), Object(Vec<(String, JsonValue)>), } fn parse(input: &str) -> Option<JsonValue> { let trimmed = input.trim(); let (value, _) = parse_value(trimmed)?; // No malloc, no free, no linked lists // RAII + enum + Vec = safe by default Some(value) }
A 9-stage pipeline that analyzes, translates, verifies, and self-repairs — driven by LLM agents with byte-exact differential testing.
Every migration produces safe, idiomatic Rust. No unsafe blocks — verified across all 15 test files including cJSON (1,441 LOC).
Both C and Rust are compiled and run with identical inputs. Outputs are compared byte-by-byte. If they diverge, the LLM agent fixes the translation automatically.
Up to 5 LLM-driven repair iterations. Compiler errors and behavioral mismatches are fed back to the agent until the output is correct.
Claude API analyzes patterns, translates idiomatically, and repairs errors. Automatic difficulty routing selects the right model for each file.
6 tools exposed via Model Context Protocol. Migrate, analyze, check, score, diff-test, and repair — directly from Claude Code or VS Code.
Side-by-side C vs Rust with syntax highlighting, idiomatic scoring (0-100), metrics dashboard, and score gauges in a single HTML file.
A substantial subset of DaveGamble/cJSON (12,510 stars) — migrated to safe, idiomatic Rust.
struct cJSON* linked list → enum JsonValue with Vecmalloc/free → RAII (automatic Drop)char* strings → Stringenum variantsgoto fail → Option<T> with ?char::from_u32IsReference flag → CloneThe only open-source tool that combines LLM translation with automated behavioral verification.
| C2Rust | Manual Rewrite | Noricum | |
|---|---|---|---|
| Approach | AST lowering | Human engineer | LLM agent + diff testing |
| Output Safety | 100% unsafe | Varies | 0 unsafe |
| Verification | Compiles | Code review | Byte-exact diff test |
| Auto-Repair | None | N/A | Up to 5 iterations |
| Speed | Seconds | Days/weeks | Seconds per file |
| IDE Integration | None | N/A | MCP server (6 tools) |
| Idiomatic Score | N/A | Subjective | 89-100/100 |
From raw C source to verified, idiomatic Rust — fully autonomous with human-in-the-loop escape hatches.
Extract C source, classify difficulty (Easy/Medium/Hard), identify patterns like malloc/free, linked lists, goto, and function pointers. Route to the right LLM model.
LLM agent translates C to idiomatic Rust using analysis results, C2Rust baseline, and RAG patterns from past successful migrations as few-shot examples.
Compile both C and Rust. Run with identical inputs. Compare outputs byte-by-byte. Score idiomatically. If anything fails — the repair agent fixes it, up to 5 times.
Real migrations on real C code. Every file verified with byte-exact differential testing.
| Source | LOC | Functions | Score | Unsafe | Diff Test |
|---|---|---|---|---|---|
| hash_table.c | 204 | 8 | 89 | 0 | PASS |
| miniz_test.c | 154 | 2 | 93 | 0 | PASS |
| cjson_combined.c | 520 | 12 | 100 | 0 | PASS |
| cjson_full.c | 1,441 | ~60 | 95+ | 0 | PASS |
| expr_eval.c | 1,686 | 74 | 100 | 0 | PASS |
Showing highlight results. 15/15 total files pass with 0 unsafe blocks. Full results on GitHub →
Three commands. That's it.
git clone https://github.com/JuanMarchetto/noricum cd noricum && cargo build --release
export ANTHROPIC_API_KEY=sk-ant-...
noricum migrate your_file.c --diff-test --report output/report.html
docker build -t noricum . docker run --rm -e ANTHROPIC_API_KEY -v $(pwd):/work noricum migrate /work/file.c
The White House, CISA, and NSA say migrate to memory-safe languages. Noricum makes it automatic.