extended BNF

views updated

extended BNF (EBNF) A notation for defining the syntax of a programming language based on BNF (Backus normal form). EBNF overcomes the main disadvantages of BNF, which are that repetition has to be expressed by a recursive definition and that options and alternatives require auxiliary definitions, by incorporating a notation to specify repetition and alternation. For example, compare the BNF definitions shown in Fig. 1 with the equivalent EBNF definitions in Fig. 2. EBNF uses {…} to denote repetition, | to denote alternatives, (…) to group constituents, and […] to denote options. Another significant difference is in the way literals are distinguished from syntactic categories. In BNF, literals are plain and syntactic categories are enclosed in angle brackets; in EBNF, syntactic categories are plain and literals are enclosed in quotation marks. This allows EBNF to define its own syntax.