Skip to content

feat(languages): add Interv support to codegraph - #1693

Draft
iacore wants to merge 2 commits into
colbymchenry:mainfrom
iacore:feat/interv-support
Draft

feat(languages): add Interv support to codegraph#1693
iacore wants to merge 2 commits into
colbymchenry:mainfrom
iacore:feat/interv-support

Conversation

@iacore

@iacore iacore commented Sep 4, 2026

Copy link
Copy Markdown

What

Adds Interv (.iv) support to CodeGraph — the self-hosting functional language in the Interv repo. Full extraction pipeline wiring, exactly as the other vendored grammars.

  • Vendored grammar: tree-sitter-interv.wasm (ABI 15, built from tree-sitter-cli 0.26.9 + wasi-sdk) in src/extraction/wasm/. Registered in WASM_GRAMMAR_FILES + VENDORED_WASM_LANGS.
  • Extension: .ivinterv in EXTENSION_MAP (this is the file-scan gate, so codegraph init discovers .iv files).
  • Extractor (src/extraction/languages/interv.ts): maps:
    • function_definition (name :: fn (binders) { body }) → function
    • data Name { Ctor(...); … }enum with each constructor as an enum_member
    • import path/to/moduleimport (module edges)
    • call_expressioncalls edges
    • class/instance → class + methods
  • Registration: LANGUAGES (types.ts), EXTRACTORS (languages/index.ts), display name "Interv".
  • Tests: detection + 4 extraction tests in __tests__/extraction.test.ts.
  • Docs: README supported-language row + CHANGELOG ### Added entry.

Verification

  • Extracted the Interv repo's examples/*.iv + src/*.iv (69 files): 532 functions, 32 enums, 100 enum members, 12 imports, 3 classesverify-extraction.mjsPASS (structural symbols, language detected, edges resolved).
  • __tests__/extraction.test.ts: all 627 tests pass (5 new Interv tests).
  • tsc clean.

Notes / gaps

  • The linear-type annotation form main : fn (1 World -> 1 World) :: fn (world: 1 World -> world: 1 World) produces one ERROR node per such file (the -> output-binder separator inside fn (...) params is ambiguous with function-type arrows). The function body and its calls still extract; only that exotic annotation reads as an AST error. Documented follow-up.
  • No public, popular Interv repos exist to benchmark against, so the agent-eval A/B (Steps 7–8 of /add-lang) is not applicable; extraction quality is measured on the Interv repo's own code instead.
  • The native Rust kernel doesn't include Interv; files route through the wasm/JS path (the per-language fallback).

iacore added 2 commits September 4, 2026 20:24
Wire Interv (.iv) into the tree-sitter extraction pipeline:
- vendor a tree-sitter-interv wasm grammar (ABI 15, built with
  tree-sitter-cli 0.26.9) for the self-hosted functional language.
- register the language in types.ts and grammars.ts (wasm file map,
  .iv extension, display name, vendored set).
- add an Interv extractor: functions (name :: fn ...), algebraic data
  types as enums with constructors as members, import path module
  edges, and call edges.
- add detection + extraction tests, a README supported-language row,
  and a CHANGELOG entry.

Verification: extraction on the Interv repo's examples + src extracts
532 functions, 32 data types, 100 constructors and 12 imports across
69 files; verify-extraction passes; extraction.test.ts (627 tests) green.
…annotation and common forms

Rebuild tree-sitter-interv.wasm from the refined grammar:
- function-type annotations (fn (1 World -> 1 World)) and fn-value
  output binders parse cleanly (a binder's type is a non-arrow type_atom,
  so the -> separator is no longer consumed as a function-type arrow).
- const definitions accept an optional trailing ';'.
- string_literal handles escape sequences (\X) and a bare '}' as
  literal content, not only interpolation.

Interv repo examples + src: 51 -> 0 AST errors in the compiler files
(parser.iv 2189 -> 1, since fixed), and the self-hosted sources parse
cleanly. Extraction: 605 functions, 32 enums, 100 constructors, 12
imports across 69 files; verify-extraction PASS.
@iacore

iacore commented Sep 4, 2026

Copy link
Copy Markdown
Author

I'll report back after I use this myself for awhile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant