datatracker.ietf.org
Sign in
Version 5.3.0, 2014-04-12
Report a bug

Augmented BNF for Syntax Specifications: ABNF
RFC 5234

Document type: RFC - Internet Standard (January 2008; Errata)
Obsoletes RFC 4234
Also Known As STD 68
Was draft-crocker-rfc4234bis (individual in app area)
Document stream: IETF
Last updated: 2013-03-02
Other versions: plain text, pdf, html

IETF State: (None)
Consensus: Unknown
Document shepherd: No shepherd assigned

IESG State: RFC 5234 (Internet Standard)
Responsible AD: Lisa Dusseault
Send notices to: dcrocker@bbiw.net, paulo@turnpike.com

Network Working Group                                    D. Crocker, Ed.
Request for Comments: 5234                   Brandenburg InternetWorking
STD: 68                                                       P. Overell
Obsoletes: 4234                                                THUS plc.
Category: Standards Track                                   January 2008

             Augmented BNF for Syntax Specifications: ABNF

Status of This Memo

   This document specifies an Internet standards track protocol for the
   Internet community, and requests discussion and suggestions for
   improvements.  Please refer to the current edition of the "Internet
   Official Protocol Standards" (STD 1) for the standardization state
   and status of this protocol.  Distribution of this memo is unlimited.

Abstract

   Internet technical specifications often need to define a formal
   syntax.  Over the years, a modified version of Backus-Naur Form
   (BNF), called Augmented BNF (ABNF), has been popular among many
   Internet specifications.  The current specification documents ABNF.
   It balances compactness and simplicity with reasonable
   representational power.  The differences between standard BNF and
   ABNF involve naming rules, repetition, alternatives, order-
   independence, and value ranges.  This specification also supplies
   additional rule definitions and encoding for a core lexical analyzer
   of the type common to several Internet specifications.

Crocker & Overell           Standards Track                     [Page 1]
RFC 5234                          ABNF                      January 2008

Table of Contents

   1.  Introduction . . . . . . . . . . . . . . . . . . . . . . . . .  3
   2.  Rule Definition  . . . . . . . . . . . . . . . . . . . . . . .  3
     2.1.  Rule Naming  . . . . . . . . . . . . . . . . . . . . . . .  3
     2.2.  Rule Form  . . . . . . . . . . . . . . . . . . . . . . . .  4
     2.3.  Terminal Values  . . . . . . . . . . . . . . . . . . . . .  4
     2.4.  External Encodings . . . . . . . . . . . . . . . . . . . .  6
   3.  Operators  . . . . . . . . . . . . . . . . . . . . . . . . . .  6
     3.1.  Concatenation:  Rule1 Rule2  . . . . . . . . . . . . . . .  6
     3.2.  Alternatives:  Rule1 / Rule2 . . . . . . . . . . . . . . .  7
     3.3.  Incremental Alternatives: Rule1 =/ Rule2 . . . . . . . . .  7
     3.4.  Value Range Alternatives:  %c##-## . . . . . . . . . . . .  8
     3.5.  Sequence Group:  (Rule1 Rule2) . . . . . . . . . . . . . .  8
     3.6.  Variable Repetition:  *Rule  . . . . . . . . . . . . . . .  9
     3.7.  Specific Repetition:  nRule  . . . . . . . . . . . . . . .  9
     3.8.  Optional Sequence:  [RULE] . . . . . . . . . . . . . . . .  9
     3.9.  Comment:  ; Comment  . . . . . . . . . . . . . . . . . . .  9
     3.10. Operator Precedence  . . . . . . . . . . . . . . . . . . . 10
   4.  ABNF Definition of ABNF  . . . . . . . . . . . . . . . . . . . 10
   5.  Security Considerations  . . . . . . . . . . . . . . . . . . . 12
   6.  References . . . . . . . . . . . . . . . . . . . . . . . . . . 12
     6.1.  Normative References . . . . . . . . . . . . . . . . . . . 12
     6.2.  Informative References . . . . . . . . . . . . . . . . . . 12
   Appendix A.  Acknowledgements  . . . . . . . . . . . . . . . . . . 13
   Appendix B.  Core ABNF of ABNF . . . . . . . . . . . . . . . . . . 13
     B.1.  Core Rules . . . . . . . . . . . . . . . . . . . . . . . . 13
     B.2.  Common Encoding  . . . . . . . . . . . . . . . . . . . . . 15

Crocker & Overell           Standards Track                     [Page 2]
RFC 5234                          ABNF                      January 2008

1.  Introduction

   Internet technical specifications often need to define a formal
   syntax and are free to employ whatever notation their authors deem
   useful.  Over the years, a modified version of Backus-Naur Form
   (BNF), called Augmented BNF (ABNF), has been popular among many
   Internet specifications.  It balances compactness and simplicity with
   reasonable representational power.  In the early days of the Arpanet,
   each specification contained its own definition of ABNF.  This
   included the email specifications, [RFC733] and then [RFC822], which
   came to be the common citations for defining ABNF.  The current
   document separates those definitions to permit selective reference.
   Predictably, it also provides some modifications and enhancements.

   The differences between standard BNF and ABNF involve naming rules,
   repetition, alternatives, order-independence, and value ranges.
   Appendix B supplies rule definitions and encoding for a core lexical
   analyzer of the type common to several Internet specifications.  It
   is provided as a convenience and is otherwise separate from the meta

[include full document text]