[ANN] [POC] grep_cmt: structural search of OCaml code

Dear all,

As mentioned in a previous post:

I had promised to post back here when we had made the source code for the “structural grep” tool that I presented, public.

This is now done:

https://github.com/LexiFi/grep_cmt

We added a [POC] marker to this post, because the code is not really ready for public consumption (it is rough around the edges and may not work in all circumstances). Our hope is to publicize the approach and perhaps motivate interested hackers to take the code and develop it further into a proper tool.

cc @vds @xvw @art-w

Cheers,
Edwin (@edwinans) & Nicolas (@nojb) for LexiFi

13 Likes

Excellent! Thanks a lot for sharing! Integrating it in Merlin could be very nice!

3 Likes

Very happy to see work like this, even if it’s in earlier stages!

Have hacked together a much more primitive solution to a similar problem with ast-grep by autogenerating rules from tree-sitter tree of OCaml snippets (tree-sitter query could be used for similar purposes), but it doesn’t allow as much flexibility as this would afford.

Very nice. I would love to integrate some of this in semgrep so that we can leverage the semantic information (e.g., good names, types) in cmt from semgrep rules.

1 Like