Jump to content

Extended Backus–Naur form

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by 2603:8001:4400:dc3:414d:d0d:8aac:6a04 (talk) at 07:45, 24 September 2024. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

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 } );
  • 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

References