Skip to content

feat: add SystemVerilog/Verilog, Tcl, and VHDL language support - #1508

Open
3brahimi wants to merge 3 commits into
colbymchenry:mainfrom
3brahimi:feat/hdl-languages-verilog-tcl-vhdl
Open

feat: add SystemVerilog/Verilog, Tcl, and VHDL language support#1508
3brahimi wants to merge 3 commits into
colbymchenry:mainfrom
3brahimi:feat/hdl-languages-verilog-tcl-vhdl

Conversation

@3brahimi

@3brahimi 3brahimi commented Aug 5, 2026

Copy link
Copy Markdown

Adds three new language extractors for HDL codebases, each backed by a vendored tree-sitter WASM grammar:

  • SystemVerilog / Verilog (.sv, .svh, .v) Modules, interfaces, packages, classes, programs, checkers, UDP declarations as class nodes; functions/tasks; typedef, struct/union, enum names; net/data/parameter/port declarations as fields; module instantiation call edges; package import and `include import edges. Grammar: tree-sitter/tree-sitter-verilog (MIT), ABI 14.

  • Tcl (.tcl) Procedures and namespaces as functions/classes; set variable assignments; source file.tcl as import edges; all other commands as call edges. Grammar: tree-sitter-grammars/tree-sitter-tcl (MIT), ABI 14.

  • VHDL (.vhd, .vhdl) Entities, architectures, packages, components as class nodes; functions/procedures; records, enumerations, subtypes; signal/ variable/constant declarations; use clause imports; call edges. Grammar: alemuller/tree-sitter-vhdl (MIT), ABI 14.

The three WASM files are vendored under src/extraction/wasm/ (same pattern as existing vendored grammars for arkts, nix, terraform, etc.) and added to VENDORED_WASM_LANGS. Attribution added to the WASM block comment in grammars.ts. README Supported Languages table updated.

Adds three new language extractors for HDL codebases, each backed by
a vendored tree-sitter WASM grammar:

  - SystemVerilog / Verilog (.sv, .svh, .v)
    Modules, interfaces, packages, classes, programs, checkers, UDP
    declarations as class nodes; functions/tasks; typedef, struct/union,
    enum names; net/data/parameter/port declarations as fields; module
    instantiation call edges; package import and `include import edges.
    Grammar: tree-sitter/tree-sitter-verilog (MIT), ABI 14.

  - Tcl (.tcl)
    Procedures and namespaces as functions/classes; set variable
    assignments; source file.tcl as import edges; all other commands as
    call edges.
    Grammar: tree-sitter-grammars/tree-sitter-tcl (MIT), ABI 14.

  - VHDL (.vhd, .vhdl)
    Entities, architectures, packages, components as class nodes;
    functions/procedures; records, enumerations, subtypes; signal/
    variable/constant declarations; use clause imports; call edges.
    Grammar: alemuller/tree-sitter-vhdl (MIT), ABI 14.

The three WASM files are vendored under src/extraction/wasm/ (same
pattern as existing vendored grammars for arkts, nix, terraform, etc.)
and added to VENDORED_WASM_LANGS. Attribution added to the WASM block
comment in grammars.ts. README Supported Languages table updated.
Copilot AI lite review requested due to automatic review settings August 5, 2026 12:34

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds new Tree-sitter (WASM) backed language support for HDL-oriented repositories (SystemVerilog/Verilog, VHDL) plus Tcl, wiring them into CodeGraph’s language detection and extractor registry and documenting the new coverage.

Changes:

  • Added verilog, tcl, and vhdl to the supported language IDs and to the extractor registry.
  • Vendored and registered three new WASM grammars and mapped common file extensions to the new languages.
  • Added new per-language extractor configs and updated README “Supported Languages”.

Reviewed changes

Copilot reviewed 7 out of 10 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/types.ts Adds new language IDs to the LANGUAGES list.
src/extraction/languages/vhdl.ts New VHDL extractor configuration.
src/extraction/languages/verilog.ts New SystemVerilog/Verilog extractor configuration.
src/extraction/languages/tcl.ts New Tcl extractor configuration.
src/extraction/languages/index.ts Registers new extractors in EXTRACTORS.
src/extraction/grammars.ts Registers new WASM grammar files, extension mappings, and display names; adds vendored attribution notes.
README.md Documents the newly supported languages and their extraction coverage.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/extraction/languages/tcl.ts Outdated
Comment thread src/extraction/languages/tcl.ts
Comment thread src/extraction/languages/verilog.ts
Comment thread src/extraction/languages/verilog.ts
Comment thread src/extraction/languages/verilog.ts
Comment thread src/extraction/languages/vhdl.ts
Comment thread src/extraction/grammars.ts
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

@3brahimi 3brahimi left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code is reviewed, fixes has been applied and is ready to merge.

@3brahimi 3brahimi closed this Aug 5, 2026
@3brahimi 3brahimi reopened this Aug 5, 2026
The autofix commit (be6bfa1) correctly diagnosed two real bugs —
importTypes: [] made extractImport dead code for 'source' detection
(else-if dispatch never reaches it), and variableTypes: ['set']
silently skipped visiting a set statement's children, dropping call
edges for command substitutions like set x [foo]. Both are properly
fixed by the new visitNode hook.

But the patch left the old extractImport method body orphaned after
visitNode's closing brace with no wrapping method signature — 17
syntax errors, doesn't compile. Removed the dead lines; visitNode
already covers everything they did. Verified: source now creates an
import edge, and set result [helper foo] now creates a call edge to
helper — both broken before this fix, both work now.
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.

2 participants