A bidirectional RAPTOR-style flowchart editor for C programs. Parses all C functions in a .c file into an interactive SVG flowchart with tabs, and keeps the code and chart in sync.
| Requirement | Version |
|---|---|
| Node.js | ≥ 18 |
| npm | ≥ 9 |
| VS Code | ≥ 1.85 |
cd raptor-flowchart
npm install
npm run compile
raptor-flowchart/ folder in VS Code.sample/demo.c.RAPTOR: Open Flowchart from the Command Palette (Ctrl+Shift+P).A side panel opens with the interactive flowchart.
+ (after the last tab) to create a new function — fill in name, return type, and parameters.for header).call nodes use the format result = funcName(args) or funcName(args).for nodes use the format init; condition; increment.+ circle on any arrow to insert a new node at that position.+ inside a while body inserts into that body.| Direction | Trigger |
|—|—|
| Code → Chart | Save the .c file (Ctrl+S) |
| Chart → Code | Any node edit or insertion in the webview (immediate) |
FunctionIR {
name: string // C function name
returnType: string // e.g. "int", "void"
params: string // raw param list, e.g. "int n"
body: FlowNode[] // always starts with start, ends with end
}
IR { functions: FunctionIR[] }
FlowNode =
| { type: "start" }
| { type: "end" }
| { type: "assign", label: string }
| { type: "io", label: string }
| { type: "if", condition: string, trueBranch: FlowNode[], falseBranch: FlowNode[] }
| { type: "while", condition: string, body: FlowNode[] }
| { type: "for", init: string, condition: string, increment: string, body: FlowNode[] }
| { type: "call", name: string, args: string, assignTo?: string }
| Node type | SVG shape | Colour |
|---|---|---|
start / end |
Oval (ellipse) | Green / Red |
assign |
Rectangle | Blue |
io |
Parallelogram | Orange |
if / while / for |
Diamond | Olive |
call |
Rectangle + double side stripes | Purple |
call (recursive) |
As above + ↺ loop arc |
Purple + Red arc |
Add a new generator function in src/parser.ts:
export function generateJava(ir: IR): string {
// emit Java class + methods from ir.functions
}
The IR is language-agnostic — the same FunctionIR[] structure works for any imperative language.
raptor-flowchart/
├── src/
│ ├── ir.ts — IR type definitions (pure types, no runtime code)
│ ├── parser.ts — C parser + C/Python code generators
│ ├── webview.ts — Self-contained HTML/SVG/JS flowchart panel
│ └── extension.ts — VS Code activation, command, bidirectional sync
├── sample/
│ └── demo.c — Sample file exercising all node types
├── out/ — Compiled JS (generated by tsc)
├── package.json
└── tsconfig.json