|
Article on other languages:
|
In computer science, Augmented Backus–Naur Form (ABNF) is a metalanguage based on Backus–Naur Form (BNF), but consisting of its own syntax and derivation rules. The motive principle for ABNF is to describe a formal system of a language to be used as a bidirectional communications protocol. It is defined by Internet Standard 68 (STD 68), which as of May 2008 is RFC 5234, and it often serves as the definition language for IETF communication protocols.[1][2] RFC 5234 supersedes RFC 4234 (which superseded RFC 2234).[3]
IntroductionAn ABNF specification is a set of derivation rules, written as
where rule is a case-sensitive nonterminal, the definition consists of sequences of symbols that define the rule, a comment for documentation, and ending with a carriage return and line feed. Rule names are case insensitive: Angle brackets (“ ABNF is encoded in ASCII (which is seven bits) in an eight-bit field with the high bit set to zero. Terminal valuesTerminals are specified by one or more numeric characters. Numeric characters may be specified as the percent sign “ Literal text is specified through the use of a string enclosed in quotation marks ( OperatorsWhite spaceWhite space is used to separate elements of a definition; for space to be recognized as a delimiter it must be explicitly included. Concatenation
A rule may be defined by listing a sequence of rule names. To match the string “aba” the following rules could be used:
Alternation
A rule may be defined by a list of alternative rules separated by a solidus (" To accept the rule fu or the rule bar the following rule could be constructed:
Incremental alternatives
Additional alternatives may be added to a rule through the use of “ The rule
is equivalent to
Value range
A range of numeric values may be specified through the use of a hyphen (“ The rule
is equivalent to
Sequence group
Elements may be placed in parentheses to group rules in a definition. To match “elem fubar snafu” or “elem tarfu snafu” the following rule could be constructed:
To match “elem fubar” or “tarfu snafu” the following rules could be constructed:
Variable repetition
To indicate repetition of an element the form Use Specific repetition
To indicate an explicit number of elements the form Use Optional sequence
To indicate an optional element the following constructions are equivalent:
Comment
A semicolon (“ Operator precedenceThe following operators have the given precedence from tightest binding to loosest binding:
Use of the alternative operator with concatenation may be confusing and it is recommended that grouping be used to make explicit concatenation groups. Core rulesThe core rules are defined in the ABNF standard.
ExampleThe postal address example given in the Backus–Naur Form (BNF) page may be specified as follows:
PitfallsRFC 5234 adds a warning in conjunction to the definition of LWSP as follows: ; Use of this linear-white-space rule ; permits lines containing only white ; space that are no longer legal in ; mail headers and have caused ; interoperability problems in other ; contexts. ; Do not use when defining mail ; headers and use with caution in ; other contexts. References
|
This article is from Wikipedia. All text is available under the terms of the GNU Free Documentation License.
Mercedes Car
This site monitored by SitePinger.net