3 ms·
There is no standard, should we have a standard? Who should design such a standard? Is a form of EBNF the best for representing computer language grammars for b
by richardjam73 4y ago
There is no standard, should we have a standard? Who should design such a standard? Is a form of EBNF the best for representing computer language grammars for both humans and machines?
Recently I read a paper "A Translational BNF Grammar Notation (TBNF)" By Paul B Mann, Parsetec.
"EBNF is powerful, however, it describes only the recognition phase, which is only 1/3 of the
process of language translation. The second phase is the construction of an abstract-syntax tree
and the third phase is the creation of an instruction code sequence. Some parser generators
automate the construction of an AST, but none, that I know of, automate the output of
instruction codes."
I'm not entirley sold on the idea but it is interesting to think of what could be different in this space.
- Joker_vD 4y agoThere is a standard. At least two, actually. There is "ISO/IEC 14977:1996(E), Syntactic Metalanguage: Extended BNF" (which was mentioned in the article), and RFC 5234, "Augmented BNF for Syntax Specifications: ABNF" (which is used by almost all newer RFCs). Take your pick!
- dwheeler 4y ago14977 is a disaster, do NOT use it. See: https://dwheeler.com/essays/dont-use-iso-14977-ebnf.html https://dwheeler.com/essays/dont-use-iso-14977-ebnf.html IETF's RFC works, but it has its own problems. In particular, most people use regexes constantly, and that RFC is unnecessarily incompatible with widely-used regex format. I suggest looking at the W3C Extensible Markup Language (XML) 1.0 (Fifth Edition) as a plausible starting point: a href="https://www.w3.org/TR/xml/#sec-notation https://www.w3.org/TR/xml/#sec-notation