Replies: 14 comments
-
Interesting, so with some cleanups we can have the Nelua grammar in EBNF. And nice idea on LPegRex converting its grammar to EBNF, looks like it should not be that difficult, I may visit that in the future so I could add Nelua EBNF grammar to the documentation. |
Beta Was this translation helpful? Give feedback.
-
It would be nice if we could have a grammar for |
Beta Was this translation helpful? Give feedback.
-
Here is a first hack attempt to generate EBNF from lpeg grammars with
Ouput:
|
Beta Was this translation helpful? Give feedback.
-
With a bit more work I've got an Probably it still missing some pieces but it seems to be a good start.
Output of the json grammar:
|
Beta Was this translation helpful? Give feedback.
-
And here is the nelua EBNF using the above script to transform it and a bit of manual fix (can be improved with more work):
|
Beta Was this translation helpful? Give feedback.
-
Out of pure curiosity, will there be any performance benefit out of this candidate support? |
Beta Was this translation helpful? Give feedback.
-
what do you mean by "will there be any performance benefit out of this candidate support?" ? |
Beta Was this translation helpful? Give feedback.
-
Comparing LPegRex to EBNF, during parsing procedure, will there be any performance improvement, or is it something that doesn't matter? |
Beta Was this translation helpful? Give feedback.
-
The EBNF shown here is not meant to be replace the actual |
Beta Was this translation helpful? Give feedback.
-
Oh...in other words as a visual reference? |
Beta Was this translation helpful? Give feedback.
-
Sort of, |
Beta Was this translation helpful? Give feedback.
-
OBS.: edited the For example reading https://nelua.io/overview/#fallthrough and looking at the railroad diagram I could spot that probably for the purpose of error reporting the token
Also reading https://nelua.io/overview/#switch there is no mention that the
|
Beta Was this translation helpful? Give feedback.
-
Fascinating stuff...I have just learned a couple of new things today! |
Beta Was this translation helpful? Give feedback.
-
I just adapted/converted the Copy and paste the Any feedback is welcome ! |
Beta Was this translation helpful? Give feedback.
-
Using this online tool https://www.bottlecaps.de/convert/ to convert the cleaned up
syntaxdefs.lua
in an EBNF understood by https://www.bottlecaps.de/rr/ui we can have a nice railroad diagram (https://en.wikipedia.org/wiki/Syntax_diagram).Ideally the https://github.com/edubart/lpegrex would have an option to output naked/EBNF grammar for debugging and manipulation with other tools like I did here https://github.com/mingodad/lalr-parser-test for bison/byacc/lemon.
Copy and paste the EBNF shown bellow at https://www.bottlecaps.de/rr/ui on the tab
Edit Grammar
then click on the tabView Diagram
.Cleaned up
syntaxdefs.lua
to be accepted by https://www.bottlecaps.de/convert/:Beta Was this translation helpful? Give feedback.
All reactions