News for hackers. Stuff that matters.
Re:Don't Use ISO/IEC 14977:1996 Extended Backus-Naur Form (E... by dwheeler on Monday May 19, 2025 @06:22PM (#44035588)
I'm the author. Ask me anything!
Re:Don't Use ISO/IEC 14977:1996 Extended Backus-Naur Form (E... by ucarion on Monday May 19, 2025 @07:05PM (#44035905)
Is the main objection to RFC5234 its weird syntax for repetition (*THING, [THING], 5THING)?
Re:Don't Use ISO/IEC 14977:1996 Extended Backus-Naur Form (E... by dwheeler on Tuesday May 20, 2025 @07:16AM (#44040196)
More 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.
Re:Don't Use ISO/IEC 14977:1996 Extended Backus-Naur Form (E... by teddyh on Monday May 19, 2025 @06:25PM (#44035618)
Is there any documented version of EBNF suitable for general use?
Re:Don't Use ISO/IEC 14977:1996 Extended Backus-Naur Form (E... by ggm on Monday May 19, 2025 @06:56PM (#44035820)
IETF uses ABNF https://datatracker.ietf.org/doc/html/rfc5234

Commentaries say its different, but the differences might not matter?

Re:Don't Use ISO/IEC 14977:1996 Extended Backus-Naur Form (E... by 90s_dev on Monday May 19, 2025 @09:16PM (#44036777)
What's your favorite programming language and why is it C?
Re:Don't Use ISO/IEC 14977:1996 Extended Backus-Naur Form (E... by dwheeler on Tuesday May 20, 2025 @07:10AM (#44040152)
I 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.
Re:Don't Use ISO/IEC 14977:1996 Extended Backus-Naur Form (E... by arh68 on Monday May 19, 2025 @09:24PM (#44036825)
Great 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

Re:Don't Use ISO/IEC 14977:1996 Extended Backus-Naur Form (E... by dwheeler on Tuesday May 20, 2025 @07:07AM (#44040137)
In 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.
Re:Don't Use ISO/IEC 14977:1996 Extended Backus-Naur Form (E... by alfiedotwtf on Monday May 19, 2025 @10:05PM (#44037078)
So 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

Re:Don't Use ISO/IEC 14977:1996 Extended Backus-Naur Form (E... by dwheeler on Tuesday May 20, 2025 @07:20AM (#44040229)
One 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.
Re:Don't Use ISO/IEC 14977:1996 Extended Backus-Naur Form (E... by alfiedotwtf on Wednesday May 21, 2025 @03:17AM (#44049081)
Oops, 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 :)