Home

ABNF

ABNF, or Augmented Backus-Naur Form, is a metalanguage used to specify the grammar of data formats and communication protocols. It is a standardized extension of the classic Backus-Naur Form and is widely employed in IETF RFCs to describe syntax. ABNF provides a precise, machine-readable way to express sequences of characters that constitute valid messages, tokens, or values, separating structure from meaning.

A grammar in ABNF consists of a set of rules. Each rule has a nonterminal name, an

Terminals may be literal text, numeric character sets, or predefined character classes. A common pattern is

ABNF grammars are descriptive and are analyzed by syntax checkers or parser generators to implement protocols

equals
sign,
and
an
element
that
defines
that
nonterminal.
Elements
can
be
terminals
(literal
strings
in
quotes
or
numeric
codes
such
as
%x41-5A),
nonterminals
(names
defined
by
other
rules),
or
constructs
for
grouping,
optional
parts,
repetition,
and
alternation.
Repetition
lets
the
author
specify
how
many
times
an
element
may
occur,
using
forms
such
as
1*DIGIT
for
one
or
more
digits,
2DIGIT
for
exactly
two
digits,
or
1*2DIGIT
for
one
to
two
digits.
Alternatives
are
expressed
with
a
slash,
and
grouping
uses
parentheses.
Optional
parts
use
square
brackets.
Comments
may
be
added
after
a
semicolon.
to
define
a
date
as:
date
=
4DIGIT
"-"
2DIGIT
"-"
2DIGIT,
with
DIGIT
defined
as
%x30-39.
Whitespace
is
generally
ignored
outside
literals,
and
case-sensitivity
is
determined
by
the
grammar
and
the
protocol
being
defined.
and
data
formats
in
a
consistent,
interoperable
way.