Tree-sitter Grammar for ROS Interface files

Hi, I’ve written tree-sitter grammar for ROS Interface files (.msg, .srv, .action).
It can be found at SuperJappie08/tree-sitter-ros-interface.

It can be used in other projects or serve as integration for your favorite editor (such as VIM or Helix).
It is setup as a generic parser/grammar, with setup instructions for Helix.

For Helix, it provides syntax highlighting and tree-sitter movements.

The grammar itself is based on the parser of rosidl_adapter and tested on 1167 ROS Interface files from released packages on Rolling.

Hope this helps!

P.S. If you encounter any issues, please let me know!

2 Likes

Nice work on this. I’m currently working on a coding assistant and using tree-sitter for structural code analysis (so far for Python and C#), and a grammar for ROS interface files could be really useful in that context. It would make it much easier to parse .msg, .srv, and .action definitions programmatically. I’d be happy to experiment with it on the ROS side and see what kind of tooling can be built around it. Thanks for sharing this.

1 Like