lark-parser / lark_syntax

Lark-flavoured EBNF grammar syntax definition for Sublime Text or TextMate

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

interactive feedback on currently open grammar file ?

asmodehn opened this issue · comments

commented

Would it be feasible to add a feature for the user to check his grammar in the editor ?

I am thinking something along the lines of https://omrelli.ug/nearley-playground/
that provides an interactive feedback to the user creating a grammar, via examples.
Or maybe being able to use the lark for syntax highlighting in other open files...

Of course, many kind of visualisations are possible (showing parse trees, etc.).
The point here is to get some bare minimum of interactive feedback directly in the editor, without having to code anything.

I think what you're suggesting with using a lark grammar for syntax highlighting in another file would be a very nice feature, but right now this package just contains a simple definition of the lark syntax. What you're proposing would require actually running lark on the test file and then somehow bypassing Sublime's own syntax highlighting. Another option would be attempting to convert the lark grammar into a Sublime syntax definition and applying that syntax to the test file, but I think that conversion would be quite difficult.

Regarding the other suggestions, automatically generating examples and such, it wouldn't really need to be a Sublime-specific feature so I would suggest asking in the main lark repository to see if anyone has any good ideas.

commented

Given that this repo is about sublime, we should probably focus this issue on the "cleanest" option :

Another option would be attempting to convert the lark grammar into a Sublime syntax definition and applying that syntax to the test file, but I think that conversion would be quite difficult.

It would be indeed a nice feature.