3 ms·
The diversity of notations stems from the fact that the current BNF notations are always lacking in something fundamental that each use case needs. For me, the
by kstenerud 4y ago
The diversity of notations stems from the fact that the current BNF notations are always lacking in something fundamental that each use case needs.
For me, the breaking point came in trying to describe binary formats. I eventually had to come up with my own: https://github.com/kstenerud/dogma https://github.com/kstenerud/dogma
Will it solve the BNF problem? No, but it does help the binary folks.
- Karellen 4y ago> current BNF notations are always lacking in something fundamental that each use case needs. There are two ways to resolve this. 1) In a way that is backwards-compatible with BNF, and 2) in a way that isn't. If you way is backwards-compatible, it's going to be much more easily understandable to anyone who already knows BNF. They don't have to go back and double-check whether some construct means concatenation or an alternative form. It also means that if someone is working on a grammar that doesn't need one of your new fundamentals and is expressible in plain BNF, they're going to write something that anyone who already knows BNF can read without any extra research. Also, if your additions are good enough, they provide a good draft of a new way to extend "official" BNF in the future. If you extend in an incompatible way, that's not even a possibility.
- kstenerud 4y agoI've seen both approaches used. And in both cases, nothing comes of it outside of the specific project (for an example, see the BNF in the XML spec). What you end up with is a bunch of small innovations in each project, but no incentive to consolidate these gains (because it's so niche to begin with, and there's no significant business advantage to be had). And of course anyone who tries will have massive pushback ala https://xkcd.com/927 https://xkcd.com/927 So everyone just does their own thing and we pretend that it's all fine.
- topaz0 4y agoIn case you missed it, this paper as I understand it is not about proposing a new "one true bnf" to become the new standard, it's about making meta-specifications for easily writing down a formal spec of how the language grammar is written, which can then be used by tools to translate and compare between the different standards. From the abstract: "instead of adding another syntactic notation and arguing about its excellence, we propose to retain the diversity and to cope with it by formally defining syntactic notations and using such definitions to import existing grammars to grammar engineering frameworks and to export (pretty-print) existing grammars to any desired syntactic notation."