kaitai-io / kaitai_struct

Kaitai Struct: declarative language to generate binary data parsers in C++ / C# / Go / Java / JavaScript / Lua / Nim / Perl / PHP / Python / Ruby
https://kaitai.io
4.04k stars 199 forks source link

Generate railroad diagrams for KS types #202

Open KOLANICH opened 7 years ago

KOLANICH commented 7 years ago

Since a KS type is a sort of grammar and since there is a nice way to represent grammars known as "railroad diagram" I think it may be nice to have a target language to generate them. I propose compile either into JS (there are libs for doing this) or into .dot (saw no libraries generating .dot from high-level description) script generating railroad diagram for this case.

https://github.com/tabatkins/railroad-diagrams

GreyCat commented 7 years ago

Well, patches are welcome, as always, but I believe that it would be non-trivial. Railroad diagrams are more or less fancy representations of regular languages, and stuff parsed by KS as a grammar is pretty different.