-
-
Notifications
You must be signed in to change notification settings - Fork 417
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
testing/debugging grammar interactively ? #149
Comments
Sorry, there isn't an interactive tool for Lark. Lark does have syntax highlighting for sublime-text, so you could use it to edit the grammar file and load it from the interpreter (it would probably be more convenient than writing the grammar in the interpreter). |
It should probably be pretty simple to fork nearley-playground and change the syntax to Lark's. It could be a nice addition to the lark toolbox. |
I am already using sublime for syntax highlighting. Syntax is usually correct, but I guess I'm getting trapped into all the non obvious cases (using this parser fails, but why ?). Related "feature request" issue is at lark-parser/lark_syntax#2 We probably would want to run Lark (python code) in the browser, somehow... Just to make sure we are actually testing lark while using it, and providing a strong guarantee for the grammar one would copy/paste between web page and lark file... Let me know if you have any preference for a Browser Python implementation ( brython, skulpt, etc.) I might give it a try sometime... |
Just for the record, and maybe inspiration, the two best tools I could find around the net : |
The first one seems nice, but a little primitive. Ideally, you'd have syntax highlighting, proper error handling, and a display of the resulting tree (when given an input). I don't have experience with brython or skulpt, or alternatives, so I'll leave it to whoever chooses to implement it. I can say that from a cursory glance, brython seems like the best choice. |
Now that Lark has an online IDE, this should be easier to implement: |
Oh the online IDE is very nice indeed ! Sadly, I probably won't have time to come back to this in the near future though, but I ll give it a spin whenever I can. |
Never loads, mon! :> |
Sorry, that's an old link! New link is https://www.lark-parser.org/ide/ |
P.S. @enjoysmath You should be able to share the same Lark instance with as many modules that you want. As long as you use the documented API, it should work fine. |
I asked in the Django forums, but was unable to get a clear answer. What
about Lark in a Django application? Do I create an instance for every
user in their request.session?
…On Wed, May 17, 2023 at 8:04 AM Erez Shinan ***@***.***> wrote:
P.S. @enjoysmath <https://github.com/enjoysmath> You should be able to
share the same Lark instance with as many modules that you want. As long as
you use the documented API, it should work fine.
—
Reply to this email directly, view it on GitHub
<#149 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAMIF56WIHFX7LGIX6EEILDXGTSHFANCNFSM4FBC6WTQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
@enjoysmath I don't remember Django well enough, but if it's technically possible to share the same Lark instance, I don't see a reason not to. |
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 other way.
The nicest tool I know is about regular expressions only : https://regex101.com/
Is there something like that for parser grammars ? where we could just add lark syntax?
I am not used to write parser grammars, and I am currently doing this in a python interpreter. The raw python error messages can be quite cryptic for a newcomer.
Any idea ? Am I missing an obvious tool here ?
The text was updated successfully, but these errors were encountered: