Extended Backus–Naur form
Basics
Examples
EBNF
BNF
Extensibility
According to the ISO 14977 standard EBNF is meant to be extensible, and two facilities are mentioned. The first is part of EBNF grammar, the special sequence, which is arbitrary text enclosed with question marks. The interpretation of the text inside a special sequence is beyond the scope of the EBNF standard. For example, the space character could be defined by the following rule:
space = ? ASCII character 32 ?;
The second facility for extension is using the fact that parentheses in EBNF cannot be placed next to identifiers (they must be concatenated with them). The following is valid EBNF:
something = foo, ( bar );
The following is not valid EBNF:
something = foo ( bar );
Therefore, an extension of EBNF could use that notation. For example, in a Lisp grammar, function application could be defined by the following rule:
function application = list( symbol, { expression } );
Related work
- The W3C publishes an EBNF notation.
- The W3C used a different EBNF to specify the XML syntax.
- The British Standards Institution published a standard for an EBNF: BS 6154 in 1981.
- The IETF uses augmented BNF (ABNF), specified in RFC 5234.
See also
- Meta-II – An early compiler writing tool and notation
- Phrase structure rules – The direct equivalent of EBNF in natural languages
- Regular expression
- Spirit Parser Framework
References
External links
- ISO/IEC 14977 : 1996(E)
- BNF/EBNF variants – A table by Pete Jinks comparing several syntaxes