ChrisDodd / btyacc

Backtracking yacc
17 stars 5 forks source link

Add an option to emit EBNF for railroad diagram #30

Open mingodad opened 1 year ago

mingodad commented 1 year ago

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 !

ChrisDodd commented 1 year ago

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

mingodad commented 1 year ago

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).