kach / nearley

📜🔜🌲 Simple, fast, powerful parser toolkit for JavaScript.
https://nearley.js.org
MIT License
3.57k stars 231 forks source link

Automatic conversion to textmate grammar #622

Open mattfysh opened 1 year ago

mattfysh commented 1 year ago

Hi @kach - thanks for this incredible work!

I was wondering if there are any guides & tools available to convert a nearley grammar into a textmate syntax highlighter? I'm doing the work manually right now, the biggest incompatibility is how textmate only works line-by-line, and it can be tricky to get multiline recognition working by using the begin/end pattern (versus the single line match rule)

Related: https://github.com/no-context/moo/issues/94

kach commented 1 year ago

Hi Matt - I don't know of any such guides or tools but I do think it would be super cool to have an automated tool that cross-compiled grammars in a standard format (e.g. nearley/moo) to syntax files for not just textmate, but other editors too (e.g. vim or emacs). I imagine this tool being especially helpful for people designing DSLs, because they can instantly get editor tooling for their DSL "for free." If you want to take up this project, I would be really excited to see what you come up with, and maybe even discuss integrating with nearley (the way nearley-railroad is). Good luck!