Open mingodad opened 3 weeks ago
Hi,
Generating different EBNFs is definitely a goal. Part of what I have been working on in V2 is being able to format the grammar output, but the current implementation is reliant on the AST which does not include comments (see: https://github.com/0x6563/grammar-well/blob/v2/src/generator/stringify/grammar/v2.ts). When I adjust the AST to be more akin to a CST then I can start writing exports for other EBNFs. But I am not sure if it will be in this repo or over in https://grammar-well.xyz/tools/migration
As for generating an EBNF for the suggested tool, I have some concerns with interoperability. Specifically the suggested tool supports character classes while Grammar-Well supports full regex expressions for non terminals as well as token classes. While I can do "best efforts" translation and format unsupported expressions as literals, it defeats the purpose of railroad diagrams.
But I do plan on implementing railroad diagrams and other tools over at the document site. So if nothing else, I'll write the tooling myself.
As far as the playground I do have something similar at https://0x6563.github.io/grammar-well-editor and https://grammar-well.xyz/tools/editor where I have been migrating everything to. Currently it's missing the AST diagram tool but the parsing functionality is there. Is there some functionality that you have in mind that you think could highlight the capabilities, or just adding a larger collection of samples?
Thank you for reply !
Looking at your playground your playground I found that you do not show lie/column
on the json/ast if they are there would be nice to click on the ast node and have the cursor jump on the sample source (and why not in the grammar too).
And for the samples would be nice to have grammars for the main parser generators (bison/yacc, antlr, peg, lezer, tree-sitter, ...)
Would be nice if this tool could create an
EBNF
accepted by (IPV6) https://www.bottlecaps.de/rr/ui or (IPV4) https://rr.red-dove.com/ui to generate grammar railroad diagrams (see example bellow).You could also add more complex grammars to show the capabilities of this tool like in https://mingodad.github.io/parsertl-playground/playground/ .