Menhir as a parser within editors (or tree-sitter?)

I have a custom language with a parser written in menhir, and I’m now developing a codemirror editor for it. I’ve read that tree-sitter (and Lezer, the codemirror specific version of it) are highly optimized for being good parsers in editors, e.g. they more often have to deal with in-progress/incomplete syntax. I’m trying to figure out whether it would make enough of a difference to be worth having two separate implementations of the lexer/parser (it would hopefully just be separate sets of definition files that I’d need to keep in sync), or whether reusing the menhir parser as much as possible is good enough.

Does anyone have experience with this? Specifically using a menhir-parsed language for the editor?


Not exactly what you’re asking but @AltGr and @chambart wrote a tool that converts a menhir parser to a tree-sitter one but I don’t know if it has been published.


Wow, this would be amazing.

That’s indeed a great tool, looking forward to read it/use it.