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", type case sic), which as of December 2010 is RFC 5234, and it often serves as the definition language for IETF communication protocols.
RFC 5234 supersedes RFC 4234 (which superseded RFC 2234).
An ABNF specification is a set of derivation rules, written as
rule = definition ; comment CR LF
where rule is a case-insensitive 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:
<rUlENamE> all refer to the same rule. Rule names consist of a letter followed by letters, numbers, and hyphens.
Angle brackets (“
>”) are not required around rule names (as they are in BNF). However they may be used to delimit a rule name when used in prose to discern a rule name.
 Terminal values
Terminals are specified by one or more numeric characters.
Numeric characters may be specified as the percent sign “
%”, followed by the base (b = binary, d = decimal, and x = hexadecimal), followed by the value, or concatenation of values (indicated by “
.”). For example a carriage return is specified by
%d13 in decimal or
%x0D in hexadecimal. A carriage return followed by a line feed may be specified with concatenation as
Literal text is specified through the use of a string enclosed in quotation marks (
"). These strings are case-insensitive and the character set used is (US-)ASCII. Therefore the string “abc” will match “abc”, “Abc”, “aBc”, “abC”, “ABc”, “AbC”, “aBC”, and “ABC”. For a case-sensitive match the explicit characters must be defined: to match “aBc” the definition will be
%d97 %d66 %d99.
 White space
White space is used to separate elements of a definition; for space to be recognized as a delimiter it must be explicitly included.
A rule may be defined by listing a sequence of rule names.
To match the string “aba” the following rules could be used:
foo = %x61 ; a
bar = %x62 ; b
mumble = foo bar foo
Rule1 / Rule2
Full article ▸