btyacc icon indicating copy to clipboard operation
btyacc copied to clipboard

Add an option to emit EBNF for railroad diagram

Open mingodad opened this issue 2 years ago • 2 comments

I did an extension to emit an EBNF understood by https://www.bottlecaps.de/rr/ui to create railroad diagrams from the grammars see here https://github.com/satya-das/cppparser/issues/16 .

I think that it's a good addition to this tool I also did the same for bison/byacc/lemon here https://github.com/mingodad/lalr-parser-test .

Cheers !

mingodad avatar May 25 '23 16:05 mingodad

I added a pull request ( #31 ) for what I think is the patch you're referring to? Looks pretty simple and straight-forward

ChrisDodd avatar May 26 '23 01:05 ChrisDodd

Thank you ! I also added a similar simple option to bison/byacc/lemon to output the naked grammar too, see here https://github.com/mingodad/lalr-parser-test/blob/a762d4987c3172e9bee91cd216656c97711534f1/byacc/reader.c#L4290 for byacc, it helps when we want to reuse the grammar to other purposes and also to debug because it makes easy to compare two versions of a grammar at syntactical level (without action code and in a normalized way).

mingodad avatar May 26 '23 07:05 mingodad