c-cpp-analyzer
Skill5 starsChanged 8 months agoMITView on GitHub
Analyze C/C++ code for Rust migration planning. Classifies functions by migration difficulty (easy/medium/hard), identifies unsafe patterns, pointer complexity, and macro usage. Use when: analyze C code, migration planning, C to Rust, assess migration difficulty, code complexity analysis.
In this repository29 other files it gives its agents.
- skills/architect/CLAUDE.mdCLAUDE.md
- skills/council/CLAUDE.mdCLAUDE.md
- agent-browserSkill
- app-store-screenshotsSkill
- architectSkill
- architecture-reviewerSkill
- councilSkill
- c-to-rust-migrationSkill
- demo-pipelineSkill
- e2e-pipelineSkill
- founder-modeSkill
- full-evalSkill
- hackathon-jurySkill
- idea-labSkill
- ios-glass-ui-designerSkill
- learn-by-mistakeSkill
- maestro-mobile-testingSkill
- migration-validatorSkill
- mobile-design-systemSkill
- noricum-devSkill
- oss-readinessSkill
- pdf-presentationSkill
- playwright-recordingSkill
- post-run-analysisSkill
- rust-migrationSkill
- ui-ux-polishSkill
- vc-evaluatorSkill
- webreelSkill
- youtube-devrelSkill
The file
Files
C/C++ Analysis for Migration
Difficulty Classification
Uses tree-sitter AST analysis with regex fallback:
- Easy: Pure functions, simple arithmetic, no pointers, <30 lines
- Medium: Pointer parameters, simple structs, bounded arrays, malloc with clear ownership
- Hard: void*, function pointers, unions, goto, complex lifetimes, macro-heavy, coroutines
Hard signals (any 1 → Hard):
gotostatementsuniontypesvoid*pointers- Function pointer callbacks
- Coroutine patterns (Duff's device,
switch-based state machines) - setjmp/longjmp
Medium signals (1+ with >30 lines → Medium):
- Pointer declarations
- Cast expressions
malloc/callocusage
Pattern Detection
| C Pattern | Rust Equivalent | Difficulty |
ptr + len pairs | &[T] slices | Medium |
| Error code returns | Result<T, E> | Easy |
| NULL checks | Option<T> | Easy |
malloc/free | Vec<T>, Box<T> | Medium |
char* strings | &str, String | Medium |
| Manual iteration with pointers | .iter(), .enumerate() | Medium |
goto cleanup | Drop trait, ? operator | Hard |
| Global mutable state | Function parameters, OnceLock | Hard |
| Bit manipulation | Same ops with explicit types | Medium |
union | enum with variants | Hard |
| Function pointers / callbacks | Enum dispatch (preferred) or Fn traits | Hard |
| Linked lists (next/prev) | Vec<T> (flatten) | Medium |
| Type tag + union (tagged union) | enum with data variants | Medium-Hard |
| Recursive data structures | enum + Box<T> | Medium |
| Coroutine via switch/case | Explicit state machine (match loop) | Hard |
| Printf format strings | format!() / println!() macros | Easy-Medium |
strdup/strcpy | .to_string(), .clone() | Easy |
Size-Based Strategy
| LOC Range | Strategy | Chunking | Repair Iters |
| <800 | Single-pass translation | No | Full (5) |
| 800-2000 | Chunked (400 LOC target) | Structural (data model first) | Full (8 for chunked) |
| 2000+ | Chunked (500 LOC target) | Structural | Reduced (2) |
| 4000+ | Consider per-module split | split_into_modules() | Reduced (2) |
Risk Flags
- Platform-specific code (
#ifdef _WIN32, inline assembly) - Undefined behavior (signed overflow, use-after-free patterns)
- Macro-heavy code (requires
cc -Eexpansion before analysis) - Variadic functions (
...parameters) - setjmp/longjmp (no safe Rust equivalent)
- Thread-unsafe global state
- Bit-exact algorithms (compression, crypto) — very hard to get semantically correct
- Files >4000 LOC — may exceed API token limits even with chunking
Migration Ceiling (learned from miniz)
Some patterns have NO safe Rust equivalent and require full algorithm redesign:
- Coroutine via switch/case (Duff's device) → explicit state machine
- Large structs with internal pointers (~300KB) → redesign needed
- Bit-level DEFLATE/INFLATE → requires exact semantic preservation
- These files need "best-effort" mode: output highest-quality version for developer to finish
Powered by Noricum — autonomous C/C++ to Rust migration agent
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

