Visual RFC.
ALL RFCs / RFC 5234
Read the RFC ↗

RFC 5234 / START HERE

ABNF grammar, before the details

ABNF means Augmented Backus–Naur Form, a notation for writing syntax rules.

It describes which sequences of characters or numeric terminal values fit a named pattern. A grammar is the set of those rules; matching checks a candidate against them.

The idea in one picture

  1. Written rule

  2. Match the parts

  3. Whole string

A simplified picture of the idea; the chapters explain the actual mechanisms.

Why it exists

Internet specifications need precise, reusable syntax. RFC5234 defines the notation and common core rules; RFC7405 later adds explicit case-sensitive strings. This guide teaches how to read those mechanisms, not how to build a complete parser.

A familiar example

An invented label rule can accept ID:42 while rejecting ID:4 because it requires two digits. A matching label still needs its application’s meaning and checks; grammar alone does not grant permission.

Helpful background

You can start here without reading another RFC. If these ideas are unfamiliar, these short introductions may help.

What you’ll learn next

Begin with chapter one, or choose a topic.

  1. Expand a named ruleA rule names a pattern; following its parts tells you which complete strings fit.
  2. Match literals and numbersQuoted letters normally ignore ASCII case; numeric terminals choose exact values.
  3. Group choices before joiningParentheses decide what belongs to an alternative; a slash does not insert a separator in data.
  4. Count repeats and optionsA repetition has inclusive bounds; brackets make the entire enclosed sequence optional.
  5. Make whitespace explicitWhitespace in the written rule does not automatically appear in the strings it describes.
Start with chapter one →

This introduction explains RFC 5234 (2008). Read the original RFC ↗