Backus-naur form


backus-naur form
language, grammar
(bnf, originally “backus normal form”) a formal metasyntax used to express context-free grammars. backus normal form was renamed backus-naur form at the suggestion of donald knuth.
bnf is one of the most commonly used metasyntactic notations for specifying the syntax of programming languages, command sets, and the like. it is widely used for language descriptions but seldom doc-mented anywhere (how do you doc-ment a metasyntax?), so that it must usually be learned by osmosis (but see rfc 2234).
consider this bnf for a us postal address: postal-address
::= personal-part
::= | “.” name-part
::= [] | street-address
::= [] zip-part
::= “,”
this translates into english as: “a postal-address consists of a name-part, followed by a street-address part, followed by a zip-code part. a personal-part consists of either a first name or an initial followed by a dot. a name-part consists of either: a personal-part followed by a last name followed by an optional “jr-part” (jr., sr., or dynastic number) and end-of-line, or a personal part followed by a name part (this rule ill-strates the use of recursion in bnfs, covering the case of people who use multiple first and middle names and/or initials). a street address consists of an optional apartment specifier, followed by a street number, followed by a street name. a zip-part consists of a town-name, followed by a comma, followed by a state code, followed by a zip-code followed by an end-of-line.”
note that many things (such as the format of a personal-part, apartment specifier, or zip-code) are left unspecified. these lexical details are presumed to be obvious from context or specified somewhere nearby.
there are many variants and extensions of bnf, possibly containing some or all of the regexp wild cards such as “-” or “+”. ebnf is a common one. in fact the example above isn’t the pure form invented for the algol 60 report. “[]” was introduced a few years later in ibm’s pl/i definition but is now universally recognised. abnf is another extension.
(1997-11-23)

Read Also:

  • Backward analysis

    backward -n-lysis theory an -n-lysis to determine properties of the inputs of a program from properties or context of the outputs. e.g. if the output of this function is needed then this argument is needed. compare forward -n-lysis. (1997-11-23)

  • Backward and forward

    toward the back or rear. with the back foremost. in the reverse of the usual or right way: counting backward from 100. toward the past: to look backward over one’s earlier mistakes. toward a less advanced state; retrogressively: since the overthrow of the president the country has moved steadily backward. directed toward the back or […]

  • Backward chaining

    backward chaining algorithm an algorithm for proving a goal by recursively breaking it down into sub-goals and trying to prove these until facts are reached. facts are goals with no sub-goals which are therefore always true. backward training is the program execution mechanism used by most logic programming language like prolog. opposite: forward chaining. (2004-01-26)

  • Backward combatability

    backward combatability humour /bak’w-d k-m-bat’–bil’–tee/ (play on “backward compatibility”) a property of hardware or software revisions in which previous protocols, formats, layouts, etc. are irrevocably discarded in favour of “new and improved” protocols, formats and layouts, leaving the previous ones not merely deprecated but actively defeated. (too often, the old and new versions cannot definitively […]

  • Backward compatibility

    backward compatibility jargon able to share data or commands with older versions of itself, or sometimes other older systems, particularly systems it intends to supplant. sometimes backward compatibility is limited to being able to read old data but does not extend to being able to write data in a format that can be read by […]


Disclaimer: Backus-naur form definition / meaning should not be considered complete, up to date, and is not intended to be used in place of a visit, consultation, or advice of a legal, medical, or any other professional. All content on this website is for informational purposes only.