3 ms·
I'm the author. Ask me anything!
by dwheeler 1y ago
I'm the author. Ask me anything!
- teddyh 1y agoIs there any documented version of EBNF suitable for general use?
- ggm 1y agoIETF uses ABNF https://datatracker.ietf.org/doc/html/rfc5234 https://datatracker.ietf.org/doc/html/rfc5234 Commentaries say its different, but the differences might not matter?
- ucarion 1y agoIs the main objection to RFC5234 its weird syntax for repetition (*THING, [THING], 5THING)?
- dwheeler 1y agoMore or less. It's a perfectly workable approach, but it's the reverse of what practically everyone else does, as well as the reverse of regex notation. Common notations should be common.
- 90s_dev 1y agoWhat's your favorite programming language and why is it C?
- dwheeler 1y agoI like lots of programming languages, I don't really have 1 favorite. I like the relative simplicity of C, and I have long familiarity with it, but its lack of memory safety and endless undefined behavior make it more difficult to safely use than necessary.
- arh68 1y agoGreat article. Informative, qualified. I had not realized how splintered the [E]BNF syntax is, like in the way I already knew timestamps are (3339 vs 8601 vs mm/dd/yyyy &c &c). Q: what's your ideal way to write Unicode characters clearly? In the W3C/XML spec they'll have stuff like [#x200C-#x200D] but I have no idea what those are, without like a dictionary on hand. Points for specificity, but it doesn't scream "readable". Your point about standards-not-publicly-available is unfortunately similar to, well, laws. In some areas, "the laws" themselves are not public (!) though perhaps it's a digression better to not get into pedantically, s/unabiguously/unambiguously/g
- dwheeler 1y agoIn many cases I think the character itself is clearest. Thankfully most tools can handle Unicode today. That's not always unambiguous, so sometimes an annotation may be helpful, and if the spec is freely available you can copy amd paste from it.
- alfiedotwtf 1y agoSo if not EBNF for defining grammars, what should people be using ie what would be your preferred that would be powerfully enough and general purpose? I’ve never seen PCRE used for grammars and not sure if it would be powerfully enough for all cases, but personally I think it would be pretty cool since I find it easier to read than EBNF and it’s so widely used people can slot a specification right into code and it should just work
- dwheeler 1y agoOne of those alternative specifications is in the W3C Extensible Markup Language (XML) 1.0 (Fifth Edition). As I note, "The W3C specification is much more similar to typical regex syntax making it much easier for today's software developers to understand), avoids the key problems of 14977:1996, and is already clearly described." It's freely available from w3c. You don't need to use XML to use it.
- alfiedotwtf 1y agoOops, sorry. When you said that I thought there was going to be an actual specification of the grammar specification itself rather than the application in use. Ok cool, got it thanks :)