The Backus–Naur form (BNF) (also known as the Backus–Naur formalism, Backus normal form, or Panini–Backus Form) is a metasyntax used to express context-free grammars: that is, a formal way to describe formal languages.
BNF is widely used as a notation for the grammars of computer programming languages, command sets and communication protocols, as well as a notation for representing parts of natural language grammars (for example, meter in Venpa poetry.) Most textbooks for programming language theory and/or semantics document the programming language in BNF. Some variants, such as augmented Backus-Naur form (ABNF), have their own documentation.
BNF was originally named after John Backus and later (at the suggestion of Donald Knuth) also after Peter Naur. They were two pioneers in computer science, especially in the art of compiler design. The Backus–Naur Form or BNF grammars have significant similarities to 's grammar rules, and is sometimes also referred to as Panini–Backus Form. BNF was created as part of creating the rules for Algol 60.
where <symbol> is a nonterminal, and the expression consists of sequences of symbols and/or sequences separated by the vertical bar, '|', indicating a choice, the whole being a possible substitution for the symbol on the left. Symbols that never appear on a left side are terminals.
This translates into English as:
Note that many things (such as the format of a personal-part, apartment specifier, or ZIP-code) are left unspecified here. If necessary, they may be described using additional BNF rules, or left as abstraction if irrelevant for the purpose at hand.
| "("
This assumes that no whitespace is necessary for proper interpretation of the rule.
is presumed to be the " character, and
Parsing expression grammars build on the BNF and regular expression notations to form an alternative class of formal grammar, which is essentially analytic rather than generative in character.
BNF | Backus-Naur-Form | Backus-Naur form | Forme de Backus-Naur | BNF | Backus-Naur Form | ბეკუს–ნაურის ფორმალიზმი | Backus-Naur-formalisme | バッカス・ナウア記法 | Notacja BNF | Forma Normal de Backus | Форма Бэкуса-Наура | பேக்கஸ்-நார் முறை | Backus-Naur form | 巴科斯范式
This article is licensed under the GNU Free Documentation License.
It uses material from the
"Backus–Naur form".
Home Page • arts • business • computers • games • health • hospitals • home • kids & teens • news • physicians • recreation• reference • regional • science • shopping • society • sports • world