Open Source · MIT License

Forge C into
Safe Rust

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.

View on GitHub
$ git clone https://github.com/JuanMarchetto/noricum
cjson.c unsafe
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;
}
cjson.rs 0 unsafe
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)
}
16,779
Lines of Rust
302+
Tests Passing
0
Unsafe Blocks
15/15
Migrations Verified

Every other tool translates and hopes.
Noricum translates and proves.

A 9-stage pipeline that analyzes, translates, verifies, and self-repairs — driven by LLM agents with byte-exact differential testing.

Zero Unsafe Output

Every migration produces safe, idiomatic Rust. No unsafe blocks — verified across all 15 test files including cJSON (1,441 LOC).

Byte-Exact Diff Testing

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.

Self-Healing Repair Loop

Up to 5 LLM-driven repair iterations. Compiler errors and behavioral mismatches are fed back to the agent until the output is correct.

LLM-Powered Agents

Claude API analyzes patterns, translates idiomatically, and repairs errors. Automatic difficulty routing selects the right model for each file.

MCP Server for IDEs

6 tools exposed via Model Context Protocol. Migrate, analyze, check, score, diff-test, and repair — directly from Claude Code or VS Code.

HTML Migration Reports

Side-by-side C vs Rust with syntax highlighting, idiomatic scoring (0-100), metrics dashboard, and score gauges in a single HTML file.

Flagship: cJSON Migration

A substantial subset of DaveGamble/cJSON (12,510 stars) — migrated to safe, idiomatic Rust.

C Lines of Code 1,441
Rust Lines of Code
1,098 0.76x
Unsafe Blocks 0
Raw Pointers 0
Tests 55/55 PASS
Diff Test PASS (byte-exact)

Key Transformations

struct cJSON* linked list enum JsonValue with Vec
malloc/free RAII (automatic Drop)
char* strings String
Type tag integers enum variants
goto fail Option<T> with ?
UTF-16 surrogate pairs char::from_u32
IsReference flag Clone

How Noricum Compares

The 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

9-Stage Migration Pipeline

From raw C source to verified, idiomatic Rust — fully autonomous with human-in-the-loop escape hatches.

Phase 1 · Analyze

Understand

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.

Extraction Classification C2Rust
Phase 2 · Translate

Transform

LLM agent translates C to idiomatic Rust using analysis results, C2Rust baseline, and RAG patterns from past successful migrations as few-shot examples.

LLM Analysis Translation RAG Patterns
Phase 3 · Verify

Prove

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.

Diff Test Repair Loop Scoring

Benchmark Results

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 →

Get Started

Three commands. That's it.

1

Clone & Build

git clone https://github.com/JuanMarchetto/noricum
cd noricum && cargo build --release
2

Set your API key

export ANTHROPIC_API_KEY=sk-ant-...
3

Migrate

noricum migrate your_file.c --diff-test --report output/report.html
Or use Docker
docker build -t noricum .
docker run --rm -e ANTHROPIC_API_KEY -v $(pwd):/work noricum migrate /work/file.c

Memory safety
shouldn't be this hard.

The White House, CISA, and NSA say migrate to memory-safe languages. Noricum makes it automatic.