Skip to content

Add MATLAB support (.m files) — grammar already exists on PyPI #1702

Description

@catalystdream

Summary

graphify currently has no MATLAB/tree-sitter support at all — .m files fall through to a bare file-stub node with zero structural edges (no functions, no calls, no cross-file imports/references detected), even though a real, maintained tree-sitter grammar for MATLAB already exists and is installable as a normal dependency.

Evidence

  • Checked the installed graphifyy package dependencies (uv tool install graphifyy) — no tree-sitter-matlab among the 27 language grammars bundled.
  • A working grammar exists: acristoffers/tree-sitter-matlab — actively maintained (updated within the last ~2 weeks as of filing), and already published on PyPI as tree-sitter-matlab (currently v1.3.0), same packaging convention as graphify's other tree-sitter-<language> dependencies.
  • Confirmed the gap concretely on a real corpus: 4 MATLAB files with genuine call/usage relationships (one script calling into another, importing shared config) extracted to 4 isolated nodes, 0 edges via graphify extract. By contrast, a 6-file Python module with equivalent internal structure extracted to 72 nodes, 152 edges in the same session — same tool, same AST-only pass, only the language differed.
  • This isn't just "reduced fidelity" — it produces a wrong-by-omission answer for any code-navigation question touching MATLAB. Asked graphify query "what code implements X", where X is a MATLAB-only feature — the correct files never appeared anywhere in a 35-node depth-2 BFS, because they have no edges to be traversed through.

Why it matters

MATLAB is heavily used in engineering/scientific domains (controls, aerospace, signal processing, simulation) where graphify's docs+code+papers pitch is otherwise a great fit — but right now those codebases get effectively no structural graph at all for their primary language.

What I looked at on the implementation side

Per-language extraction in extract.py looks hand-written per language (~150-300 lines each, e.g. the Julia block), not a generic tree-sitter-node walker — so this isn't a one-line pip install fix, it'd need a new extraction function targeting tree-sitter-matlab's specific node-type names (function definitions, classdef blocks, calls, etc.), following the same pattern as the existing per-language blocks. Flagging that context in case it's useful for scoping the work, not assuming it's trivial.

Happy to help test against a real MATLAB corpus if that's useful once there's a WIP branch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions