Skip to content

feat(matlab): add first-class MATLAB extraction support#1888

Open
TPAteeq wants to merge 1 commit into
Graphify-Labs:v8from
TPAteeq:feat/matlab-support
Open

feat(matlab): add first-class MATLAB extraction support#1888
TPAteeq wants to merge 1 commit into
Graphify-Labs:v8from
TPAteeq:feat/matlab-support

Conversation

@TPAteeq

@TPAteeq TPAteeq commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds first-class, deterministic MATLAB extraction for .m files, completing the parser follow-up identified in #1702.

Graphify now content-sniffs .m files and routes them to either MATLAB or Objective-C without confusing MATLAB comments, strings, or function handles for Objective-C syntax. .mm remains unambiguously Objective-C++.

MATLAB extraction runs locally and offline using the dedicated tree-sitter-matlab package. No LLM or network access is required.

What changed

  • Added a dedicated MATLAB structural extractor supporting:

    • Scripts and primary/local/nested functions
    • classdef classes and inheritance
    • Properties, access modifiers, events, and enumerations
    • Instance and static methods
    • Ignored ~ parameters with accurate arity
    • +package, nested package, @Class, and private folder conventions
    • File-level and function-scoped imports
    • Function handles, feval, command-form calls, and constructed receivers
  • Added conservative call resolution:

    • Distinguishes calls from MATLAB’s ambiguous indexing syntax
    • Resolves same-file, cross-file, imported, package-qualified, and typed-receiver calls
    • Respects nested lexical scope and private-folder visibility
    • Allows project functions to shadow MATLAB built-ins
    • Emits references when a function handle is created and indirect_call only when invoked
    • Avoids resolving bare calls to unrelated class methods
  • Hardened MATLAB/Objective-C interoperability:

    • Added explicit language provenance for ambiguous .m files
    • Prevented MATLAB nodes from merging with same-stem native header/implementation nodes
    • Prevented MATLAB classes from polluting Swift, TypeScript, C++, C#, Java, and Objective-C receiver-type indexes
    • Preserved existing C/Objective-C and Swift family boundaries
    • Added namespaced MATLAB class identities for stable cross-language disambiguation
  • Updated Graphify integration:

    • MATLAB files participate in hooks, callflow rendering, caching, portable ID remapping, and language-family analysis
    • Agent update instructions now classify .m and .mm changes as code-only updates
    • Regenerated and validated all affected skill artifacts
    • Updated the README, extractor migration table, changelog, dependency lock, and extractor registry

Validation

  • 3170 passed, 30 skipped
  • 22 focused MATLAB regression tests
  • Ruff: passed
  • Pyright: passed
  • uv lock --check: passed
  • Skill generator consistency and monolith round-trip checks: passed
  • git diff --check: passed
  • Built and installed the wheel in a fresh Python 3.10 environment
  • Verified MATLAB extraction from the installed wheel with network socket connections forcibly blocked

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