Skip to content

Conversation

julialeex
Copy link

@julialeex julialeex commented Sep 26, 2025

Added complete MATLAB language support by configuring the MATLAB grammar in _automation/grammars.json, generating TreeSitter parser files (parser.c, parser.h) from the acristoffers/tree-sitter-matlab grammar, downloading the custom scanner (scanner.c), and creating standard Go bindings (binding.go, binding_test.go, go.mod) that follow the exact same pattern as all other languages in the repository, enabling Go programs to parse MATLAB code using TreeSitter.

More Context

go-tree-sitter provides language parsing bindings, symf-private uses those bindings to extract and index symbols for search, and cody uses symf for code context retrieval.

To add MATLAB support, we

  • modified go-tree-sitter by adding MATLAB TreeSitter bindings
  • modified symf-private by creating a separate matlab-parser/ module that provides MATLAB symbol extraction
  • configured cody-review to use the updated symf binary
  • a complete pipeline from MATLAB source code → TreeSitter parsing → symbol extraction → Cody context retrieval

@julialeex julialeex changed the title Add MATLAB TreeSitter support Add MATLAB support Sep 26, 2025
@julialeex julialeex marked this pull request as ready for review September 26, 2025 23:05
Copy link
Author

Choose a reason for hiding this comment

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

auto generated from

curl -o matlab/grammar.js https://github.com/raw/acristoffers/tree-sitter-matlab/main/grammar.js
cd matlab && tree-sitter generate

Copy link
Author

Choose a reason for hiding this comment

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

also genreated from tree-sitter generate

Copy link
Author

Choose a reason for hiding this comment

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

from oss matlab tree-sitter repo
curl -o scanner.c https://github.com/raw/acristoffers/tree-sitter-matlab/main/src/scanner.c

@julialeex julialeex requested a review from beyang September 27, 2025 00:52
@julialeex julialeex changed the title Add MATLAB support Add MATLAB support (CODY-6251) Sep 27, 2025
Copy link
Member

@beyang beyang left a comment

Choose a reason for hiding this comment

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

Can you upstream these changes, as well?

@julialeex
Copy link
Author

upstream PR: smacker#190

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