URL: https://www.rfc-editor.org/rfc/rfc4234.txt
Network Working Group D. Crocker, Ed.
Request for Comments: 4234 Brandenburg InternetWorking
Obsoletes: 2234 P. Overell
Category: Standards Track THUS plc.
October 2005
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.
Copyright Notice
Copyright (C) The Internet Society (2005).
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 4234 ABNF October 2005
Table of Contents
1. INTRODUCTION ....................................................2
2. RULE DEFINITION .................................................3
2.1. Rule Naming ................................................3
2.2. Rule Form ..................................................3
2.3. Terminal Values ............................................4
2.4. External Encodings .........................................5
3. OPERATORS .......................................................6
3.1. Concatenation: Rule1 Rule2 ................................6
3.2. Alternatives: Rule1 / Rule2 ...............................6
3.3. Incremental Alternatives: Rule1 =/ Rule2 ...................7
3.4. Value Range Alternatives: %c##-## .........................7
3.5. Sequence Group: (Rule1 Rule2) .............................8
3.6. Variable Repetition: *Rule ................................8
3.7. Specific Repetition: nRule ................................9
3.8. Optional Sequence: [RULE] .................................9
3.9. Comment: ; Comment ........................................9
3.10. Operator Precedence .......................................9
4. ABNF DEFINITION OF ABNF ........................................10
5. SECURITY CONSIDERATIONS ........................................11
6. References .....................................................11
6.1. Normative References ......................................11
6.2. Informative References ....................................11
Appendix A. ACKNOWLEDGEMENTS .....................................13
Appendix B. APPENDIX - CORE ABNF OF ABNF .........................13
B.1. Core Rules ...............................................13
B.2. Common Encoding ..........................................14
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
Crocker & Overell Standards Track [Page 2]
RFC 4234 ABNF October 2005
language defined in the body of this document, and separate from its
formal status.
Changes since [RFC2234]:
In Section 3.7, the phrase: "That is, exactly