BNF stands for Backus-Naur Form, or Backus Normal Form. It is a form of notation for context-free grammars and is often used for (but is not restricted to) the description of the syntax of programming languages. In addition to programming languages, it is also used to describe communication protocols and document formats.
A BNF specification is a set of derivation rules, written as
<symbol> ::= __expression__
where <symbol>
is a nonterminal, and the __expression__
consists of one or more sequences of symbols; more sequences are separated by |
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. On the other hand, symbols that appear on a left side are non-terminals and are always enclosed between the pair <>
. The ::=
means that the symbol on the left must be replaced with the expression on the right.