diff --git a/docs/design/ccpp-kernel-port-checklist.md b/docs/design/ccpp-kernel-port-checklist.md index 14ac5d0..158a7e8 100644 --- a/docs/design/ccpp-kernel-port-checklist.md +++ b/docs/design/ccpp-kernel-port-checklist.md @@ -1,6 +1,12 @@ # C/C++ kernel port (R7a) — the bug-for-bug checklist -**Status:** survey COMPLETE (2026-07-17); grammars + walker + gates not started. +**Status:** survey COMPLETE; grammars VENDORED + suite-green (2026-07-17): +tree-sitter-c v0.24.2 (`b780e47`, parser.c `f2883ff9…`) + tree-sitter-cpp +v0.23.4 (`f41e1a0`, parser.c `2a35a43b…`, scanner.c `cf60387d…`), built with +ts-cli 0.25.10 from checked-in parser.c, in `src/extraction/wasm/` + +VENDORED_WASM_LANGS. The walker PR adds the SAME-version crates + kernel +grammar registry (kernel-grammar-parity then pins the alignment). Walker + +gates not started. This is §0a-recipe step 1's output for c/cpp: every TS-side branch the walker must mirror, with file:line anchors into the reference implementation. Read it WITH `docs/design/rust-kernel-migration-plan.md` (§0a recipe, §5 gates). @@ -17,11 +23,12 @@ dialect module), `java.rs`, `go.rs` (receiver QNs), `python.rs`. blanked bytes — all seven blanking passes (`preParseCppSource` / `preParseCSource`, `languages/c-cpp.ts:698/750`) then need NO Rust port, and every offset survives (they're all equal-length-space replacements). -2. **Metal + CUDA are NOT routed this round.** They are separate `Language` - values riding the cpp grammar; leaving them off `DEFAULT_ROUTED` keeps them - on wasm — zero risk, tiny file counts. (CUDA blanking still applies to - c/cpp-detected files via the content gate inside preParse — that rides the - hoist for free.) +2. **Metal + CUDA ride the cpp route** (corrected from the first draft): + `.metal`/`.cu` map to language `'cpp'` at detectLanguage (grammars.ts:135), + so there is no separate routing decision — when cpp routes to the kernel, + those files come along as blanked cpp. The preParse hoist MUST pass + `filePath` (the extension gates Metal-attribute blanking) and the CUDA + content gate rides for free. Their suite tests are the parity insurance. 3. **One walker module, dual language** (`codegraph-kernel/src/ccpp/`), flagged c vs cpp like `tsjs/` flags its four dialects. Grammars: tree-sitter-c + tree-sitter-cpp crates, wasm vendored from the SAME tags (sha-matched diff --git a/src/extraction/grammars.ts b/src/extraction/grammars.ts index 48de13e..2c435b9 100644 --- a/src/extraction/grammars.ts +++ b/src/extraction/grammars.ts @@ -292,6 +292,11 @@ const VENDORED_WASM_LANGS: ReadonlySet = new Set([ 'pascal', 'scala', 'lua', 'luau', 'csharp', 'r', 'cfml', 'cfscript', 'cfquery', 'cobol', 'vbnet', 'erlang', 'terraform', 'arkts', 'nix', 'typescript', 'tsx', 'javascript', 'jsx', 'java', 'python', 'go', + // R7a (C/C++ kernel port prep): tree-sitter-c v0.24.2 (b780e47) + + // tree-sitter-cpp v0.23.4 (f41e1a0), parser.c/scanner.c sha-matched against + // the crates.io tarballs. `.metal`/`.cu` map to language 'cpp', so the + // dialects ride the same (single, coherent) upgraded grammar. + 'c', 'cpp', ]); /** Absolute path of a language's grammar WASM (vendored or tree-sitter-wasms). */ diff --git a/src/extraction/wasm/tree-sitter-c.wasm b/src/extraction/wasm/tree-sitter-c.wasm new file mode 100755 index 0000000..13c8dfc Binary files /dev/null and b/src/extraction/wasm/tree-sitter-c.wasm differ diff --git a/src/extraction/wasm/tree-sitter-cpp.wasm b/src/extraction/wasm/tree-sitter-cpp.wasm new file mode 100755 index 0000000..cba731b Binary files /dev/null and b/src/extraction/wasm/tree-sitter-cpp.wasm differ