CINXE.COM

draft-ietf-drums-abnf-04 - Augmented BNF for Syntax Specifications: ABNF

<!DOCTYPE html> <html data-bs-theme="auto" lang="en" prefix="og: http://ogp.me/ns# article: http://ogp.me/ns/article#"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title> draft-ietf-drums-abnf-04 - Augmented BNF for Syntax Specifications: ABNF </title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link href="https://static.ietf.org/fonts/inter/import.css" rel="stylesheet"> <link href="https://static.ietf.org/fonts/noto-sans-mono/import.css" rel="stylesheet"> <link rel="stylesheet" href="https://static.ietf.org/dt/12.28.2/ietf/css/ietf.css"> <link rel="stylesheet" href="https://static.ietf.org/dt/12.28.2/ietf/css/select2.css"> <script src="https://static.ietf.org/dt/12.28.2/ietf/js/theme.js"></script> <style> .inline { display: inline; } </style> <meta property="og:title" content="Augmented BNF for Syntax Specifications: ABNF"> <meta property="og:url" content="https://datatracker.ietf.org/doc/draft-ietf-drums-abnf/04/"> <link rel="canonical" href="https://datatracker.ietf.org/doc/draft-ietf-drums-abnf/04/"> <meta property="og:site_name" content="IETF Datatracker"> <meta property="og:description" content="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 have come to be the common citations for defining ABNF. The current document separates out that definition, to permit selective reference. Predictably, it also provides some modifications and enhancements. [STANDARDS-TRACK]"> <meta property="og:type" content="article"> <meta property="og:image" content="https://static.ietf.org/dt/12.28.2/ietf/images/ietf-logo-card.png"> <meta property="og:image:alt" content="Logo of the IETF"> <meta property="article:section" content="IETF - Internet Engineering Task Force"> <meta property="og:image:type" content="image/png"> <meta property="og:image:width" content="1200"> <meta property="og:image:height" content="630"> <meta name="twitter:card" content="summary_large_image"> <meta property="article:author" content="Paul Overell"> <meta property="article:author" content="Dave Crocker"> <link rel="alternate" type="application/atom+xml" title="Document changes" href="/feed/document-changes/draft-ietf-drums-abnf/"> <meta name="description" content="Augmented BNF for Syntax Specifications: ABNF "> <script type="module" crossorigin="" src="https://static.ietf.org/dt/12.28.2/assets/embedded-e653257c.js"></script> <link href="https://static.ietf.org/dt/12.28.2/assets/create-pinia-singleton-091c62b7.js" type="text/javascript" crossorigin="anonymous" rel="modulepreload" as="script" /> <link href="https://static.ietf.org/dt/12.28.2/assets/Scrollbar-7de50899.js" type="text/javascript" crossorigin="anonymous" rel="modulepreload" as="script" /> <link rel="apple-touch-icon" sizes="180x180" href="https://static.ietf.org/dt/12.28.2/ietf/images/ietf-logo-nor-180.png"> <link rel="icon" sizes="32x32" href="https://static.ietf.org/dt/12.28.2/ietf/images/ietf-logo-nor-32.png"> <link rel="icon" sizes="16x16" href="https://static.ietf.org/dt/12.28.2/ietf/images/ietf-logo-nor-16.png"> <link rel="manifest" href="/site.webmanifest"> <link rel="mask-icon" href="https://static.ietf.org/dt/12.28.2/ietf/images/ietf-logo-nor-mask.svg" color="#ffffff"> <meta name="msapplication-TileColor" content="#ffffff"> <meta name="theme-color" content="#ffffff"> <script src="https://static.ietf.org/dt/12.28.2/ietf/js/ietf.js"></script> </head> <body class="navbar-offset position-relative" data-group-menu-data-url="/group/groupmenu.json"> <noscript><iframe class="status" title="Site status" src="/status/latest"></iframe></noscript> <div class="vue-embed" data-component="Status"></div> <a class="visually-hidden visually-hidden-focusable" href="#content">Skip to main content</a> <nav class="navbar navbar-expand-lg fixed-top bg-secondary-subtle"> <div class="container-fluid"> <a class="navbar-brand" href="/"> <img alt="IETF Logo" class="d-lm-none me-2" src="https://static.ietf.org/dt/12.28.2/ietf/images/ietf-logo-nor-white.svg" > <img alt="IETF Logo" class="d-dm-none me-2" src="https://static.ietf.org/dt/12.28.2/ietf/images/ietf-logo-nor.svg" > Datatracker </a> <div class="collapse navbar-collapse" id="navbar-collapse"> <ul class="nav navbar-nav flex-nowrap"> <li class="nav-item dropdown"> <a href="#" class="nav-link dropdown-toggle" role="button" data-bs-toggle="dropdown" aria-expanded="false"> Groups </a> <ul class="dropdown-menu mt-n1"> <li class="dropdown-header">By area/parent</li> <li class="dropend group-menu group-parent-2010"> <a class="dropdown-item dropdown-toggle " href="/wg/#ART"> Apps &amp; Realtime </a> </li> <li class="dropend group-menu group-parent-1008"> <a class="dropdown-item dropdown-toggle " href="/wg/#GEN"> General </a> </li> <li class="dropend group-menu group-parent-1052"> <a class="dropdown-item dropdown-toggle " href="/wg/#INT"> Internet </a> </li> <li class="dropend group-menu group-parent-1193"> <a class="dropdown-item dropdown-toggle " href="/wg/#OPS"> Ops &amp; Management </a> </li> <li class="dropend group-menu group-parent-1249"> <a class="dropdown-item dropdown-toggle " href="/wg/#RTG"> Routing </a> </li> <li class="dropend group-menu group-parent-1260"> <a class="dropdown-item dropdown-toggle " href="/wg/#SEC"> Security </a> </li> <li class="dropend group-menu group-parent-2412"> <a class="dropdown-item dropdown-toggle " href="/wg/#WIT"> Web and Internet Transport </a> </li> <li class="dropend group-menu group-parent-7"> <a class="dropdown-item dropdown-toggle " href="/program/"> IAB </a> </li> <li class="dropend group-menu group-parent-3"> <a class="dropdown-item dropdown-toggle " href="/rg/"> IRTF </a> </li> <li class="dropend group-menu group-parent-2309"> <a class="dropdown-item dropdown-toggle " href="/adm/"> IETF LLC </a> </li> <li class="dropend group-menu group-parent-1876"> <a class="dropdown-item dropdown-toggle " href="/rfcedtyp/"> RFC Editor </a> </li> <li class="dropend"> <a class="dropdown-item dropdown-toggle " href="/group/"> Other </a> <ul class="dropdown-menu ms-n1"> <li> <a class="dropdown-item " href="/ag/">Active AGs</a> </li> <li> <a class="dropdown-item " href="/area/">Active Areas</a> </li> <li> <a class="dropdown-item " href="/dir/">Active Directorates</a> </li> <li> <a class="dropdown-item " href="/iabworkshop/">Active IAB Workshops</a> </li> <li> <a class="dropdown-item " href="/program/">Active Programs</a> </li> <li> <a class="dropdown-item " href="/rag/">Active RAGs</a> </li> <li> <a class="dropdown-item " href="/team/">Active Teams</a> </li> </ul> </li> <li><hr class="dropdown-divider"></li> <li class="dropdown-header">New work</li> <li> <a class="dropdown-item " href="/group/chartering/"> Chartering groups </a> </li> <li> <a class="dropdown-item " href="/wg/bofs/"> BOFs </a> </li> <li> <a class="dropdown-item " href="/doc/bof-requests"> BOF Requests </a> </li> <li><hr class="dropdown-divider"></li> <li class="dropdown-header">Other groups</li> <li> <a class="dropdown-item " href="/group/concluded/"> Concluded groups </a> </li> <li> <a class="dropdown-item " href="/list/nonwg"> Non-WG lists </a> </li> </ul> </li> <li class="nav-item dropdown"> <a href="#" class="nav-link dropdown-toggle" role="button" data-bs-toggle="dropdown" aria-expanded="false"> Documents </a> <ul class="dropdown-menu mt-n1"> <li> <a class="dropdown-item " href="/doc/search"> Search </a> </li> <li> <a class="dropdown-item " href="/doc/recent"> Recent I-Ds </a> </li> <li> <a class="dropdown-item " href="/submit/"> I-D submission </a> </li> <li> <a class="dropdown-item " href="/doc/ad"> IESG dashboard </a> </li> <li><hr class="dropdown-divider"> </li> <li class="dropdown-header"> RFC streams </li> <li> <a class="dropdown-item " href="/stream/iab/"> IAB </a> </li> <li> <a class="dropdown-item " href="/stream/irtf/"> IRTF </a> </li> <li> <a class="dropdown-item " href="/stream/ise/"> ISE </a> </li> <li> <a class="dropdown-item " href="/stream/editorial/"> Editorial </a> </li> <li><hr class="dropdown-divider"> </li> <li class="dropdown-header"> Subseries </li> <li> <a class="dropdown-item " href="/doc/std"> STD </a> <a class="dropdown-item " href="/doc/bcp"> BCP </a> <a class="dropdown-item " href="/doc/fyi"> FYI </a> </li> </ul> </li> <li class="nav-item dropdown"> <a href="#" class="nav-link dropdown-toggle" role="button" data-bs-toggle="dropdown" aria-expanded="false"> Meetings </a> <ul class="dropdown-menu mt-n1"> <li> <a class="dropdown-item " href="/meeting/agenda"> Agenda </a> </li> <li> <a class="dropdown-item " href="/meeting/materials"> Materials </a> </li> <li> <a class="dropdown-item " href="/meeting/floor-plan"> Floor plan </a> </li> <li> <a class="dropdown-item " href="https://www.ietf.org/how/meetings/register/"> Registration </a> </li> <li> <a class="dropdown-item " href="/meeting/important-dates/"> Important dates </a> </li> <li> <a class="dropdown-item " href="/secr/sreq/"> Request a session </a> </li> <li> <a class="dropdown-item " href="/meeting/requests"> Session requests </a> </li> <li><hr class="dropdown-divider"> </li> <li class="dropdown-header"> Upcoming meetings </li> <li> <a class="dropdown-item " href="/meeting/upcoming"> Upcoming meetings </a> </li> <li><hr class="dropdown-divider"> </li> <li class="dropdown-header"> Past meetings </li> <li> <a class="dropdown-item " href="/meeting/past"> Past meetings </a> </li> <li> <a class="dropdown-item " href="https://www.ietf.org/how/meetings/past/"> Meeting proceedings </a> </li> </ul> </li> <li class="nav-item dropdown"> <a href="#" class="nav-link dropdown-toggle" role="button" data-bs-toggle="dropdown" aria-expanded="false"> Other </a> <ul class="dropdown-menu mt-n1"> <li> <a class="dropdown-item " href="/ipr/"> IPR disclosures </a> </li> <li> <a class="dropdown-item " href="/liaison/"> Liaison statements </a> </li> <li> <a class="dropdown-item " href="/iesg/agenda/"> IESG agenda </a> </li> <li> <a class="dropdown-item " href="/nomcom/"> NomComs </a> </li> <li> <a class="dropdown-item " href="/doc/downref"> Downref registry </a> </li> <li> <a class="dropdown-item " href="/stats/"> Statistics </a> <ul class="dropdown-menu mt-n1"> <li> <a class="dropdown-item " href="/stats/document/"> I-Ds/RFCs </a> </li> <li> <a class="dropdown-item " href="/stats/meeting/"> Meetings </a> </li> </ul> </li> <li> <a class="dropdown-item " href="/api/"> API Help </a> </li> <li> <a class="dropdown-item " href="/release/"> Release notes </a> </li> <li> <a class="dropdown-item " target="_blank" href="https://status.ietf.org"> System status </a> </li> <li><hr class="dropdown-divider"> </li> <li> <a class="dropdown-item text-danger " target="_blank" href="https://github.com/ietf-tools/datatracker/issues/new/choose"> <i class="bi bi-bug"> </i> Report a bug </a> </li> </ul> </li> <li class="nav-item dropdown"> <a href="#" class="nav-link dropdown-toggle" role="button" data-bs-toggle="dropdown" aria-expanded="false"> User </a> <ul class="dropdown-menu mt-n1 "> <li> <a class="dropdown-item " rel="nofollow" href="/accounts/login/?next=/doc/draft-ietf-drums-abnf/04/"> Sign in </a> </li> <li> <a class="dropdown-item " rel="nofollow" href="/accounts/reset/"> Password reset </a> </li> <li> <a class="dropdown-item " href="/accounts/settings/" rel="nofollow"> Preferences </a> </li> <li> <a class="dropdown-item " href="/accounts/create/"> New account </a> </li> </ul></li> </ul> </div> <div class="d-flex align-items-center"> <a class="nav-link text-danger d-none d-xl-inline me-xl-4" target="_blank" href="https://github.com/ietf-tools/datatracker/issues/new/choose"> Report a bug <i class="bi bi-bug"></i> </a> <a class="btn me-1 btn-warning d-none d-sm-block" rel="nofollow" href="/accounts/login/?next=/doc/draft-ietf-drums-abnf/04/"> Sign in </a> <label class="d-none d-md-block" aria-label="Document search"> <input class="form-control select2-field search-select" id="navbar-doc-search" data-select2-ajax-url="/doc/select2search/document/all/" type="text" data-placeholder="Document search"> </label> </div> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar-collapse" aria-controls="navbar-collapse" aria-expanded="false" aria-label="Toggle navigation"> <i class="navbar-toggler-icon"></i> </button> </div> </nav> <main class="pt-3 container-fluid" id="main"> <div class="row"> <div class="col mx-lg-3 ietf-auto-nav" id="content"> <noscript> <div class="alert alert-danger alert-ignore my-3"> <b>Javascript disabled?</b> Like other modern websites, the IETF Datatracker relies on Javascript. Please enable Javascript for full functionality. </div> </noscript> <h1> Augmented BNF for Syntax Specifications: ABNF <br> <small class="text-body-secondary">draft-ietf-drums-abnf-04</small> </h1> <ul class="nav nav-tabs my-3"> <li class="nav-item"> <a class="nav-link active" href="/doc/draft-ietf-drums-abnf/"> Status </a> </li> <li class="nav-item"> <a class="nav-link " href="/doc/draft-ietf-drums-abnf/ballot/"> IESG evaluation record </a> </li> <li class="nav-item"> <a class="nav-link " href="/doc/draft-ietf-drums-abnf/writeup/"> IESG writeups </a> </li> <li class="nav-item"> <a class="nav-link " href="/doc/draft-ietf-drums-abnf/email/"> Email expansions </a> </li> <li class="nav-item"> <a class="nav-link " href="/doc/draft-ietf-drums-abnf/history/"> History </a> </li> </ul> <label class="my-1 fw-bold">Versions:</label> <nav class="mb-3"> <ul class="revision-list pagination pagination-sm text-center flex-wrap"> <li class="page-item "> <a class="page-link" href="/doc/draft-ietf-drums-abnf/04/" > 04 </a> </li> <li class="page-item rfc"> <a class="page-link" href="/doc/rfc2234/"> RFC 2234 </a> </li> </ul> </nav> <div id="doc-timeline"></div> <div class="alert alert-warning my-3"> The information below is for an old version of the document that is already published as an RFC. </div> <table class="table table-sm table-borderless"> <tbody class="meta align-top border-top"> <tr> <th scope="row">Document</th> <th scope="row">Type</th> <td class="edit"></td> <td> <div>This is an older version of an Internet-Draft that was ultimately published as <a href="/doc/rfc2234/">RFC 2234</a>.</div> </td> </tr> <tr> <td></td> <th scope="row">Authors</th> <td class="edit"> </td> <td> <span ><a title="Datatracker profile of Paul Overell" href="/person/paulo@turnpike.com" >Paul Overell</a> <a href="mailto:paulo%40turnpike.com" aria-label="Compose email to paulo@turnpike.com" title="Compose email to paulo@turnpike.com"> <i class="bi bi-envelope"></i></a></span>, <span ><a title="Datatracker profile of Dave Crocker" href="/person/dhc@dcrocker.net" >Dave Crocker</a> <a href="mailto:dhc%40dcrocker.net" aria-label="Compose email to dhc@dcrocker.net" title="Compose email to dhc@dcrocker.net"> <i class="bi bi-envelope"></i></a></span> </td> </tr> <tr> <td></td> <th scope="row">Last updated</th> <td class="edit"></td> <td> 2020-01-21 <span class="text-body-secondary">(Latest revision 1997-09-29)</span> </td> </tr> <tr> <td></td> <th scope="row"> RFC stream </th> <td class="edit"> </td> <td > Internet Engineering Task Force (IETF) </td> </tr> <tr> <td></td> <th scope="row"> Intended RFC status </th> <td class="edit"> </td> <td> Draft Standard </td> </tr> <tr> <td></td> <th scope="row"> Formats </th> <td class="edit"> </td> <td> <div class="buttonlist"> <a class="btn btn-primary btn-sm" target="_blank" href="https://www.ietf.org/archive/id/draft-ietf-drums-abnf-04.txt"> <i class="bi bi-file-text"></i> txt </a> <a class="btn btn-primary btn-sm" href="/doc/html/draft-ietf-drums-abnf-04"> <i class="bi bi-file-code"></i> htmlized </a> <a class="btn btn-primary btn-sm" target="_blank" href="/doc/draft-ietf-drums-abnf/04/bibtex/"> <i class="bi bi-file-ruled"></i> bibtex </a> <a class="btn btn-primary btn-sm" target="_blank" href="/doc/bibxml3/draft-ietf-drums-abnf-04.xml"> <i class="bi bi-file-code"></i> bibxml </a> </div> </td> </tr> <tr> <td> </td> <th scope="row"> Additional resources </th> <td class="edit"> </td> <td> <a href="ftp://cs.utk.edu/pub/drums/mail-archive/"> Mailing list discussion </a> </td> </tr> </tbody> <tbody class="meta border-top"> <tr> <th scope="row"> Stream </th> <th scope="row"> <a href="/doc/help/state/draft-stream-ietf/"> WG state </a> </th> <td class="edit"> </td> <td> <span class="text-body-secondary"> (None) </span> </td> </tr> <tr> <td></td> <th scope="row"> Document shepherd </th> <td class="edit"> </td> <td> <span class="text-body-secondary"> (None) </span> </td> </tr> </tbody> <tbody class="meta border-top"> <tr> <th scope="row"> IESG </th> <th scope="row"> <a href="/doc/help/state/draft-iesg/"> IESG state </a> </th> <td class="edit"> </td> <td> <span class=""> Became <a href="/doc/rfc2234/">RFC 2234</a> (Proposed Standard) </span> </td> </tr> <tr> <td></td> <th scope="row"> Action Holders </th> <td class="edit"> </td> <td> <div> <span class="text-body-secondary"> (None) </span> </div> </td> </tr> <tr> <td></td> <th scope="row"> Consensus boilerplate </th> <td class="edit"> </td> <td> <span class="text-danger" title="Whether the document is the result of a community consensus process as defined in RFC 5741"> Unknown </span> </td> </tr> <tr> <td></td> <th scope="row"> Telechat date </th> <td class="edit"> </td> <td> <span class="text-body-secondary"> (None) </span> </td> </tr> <tr> <td></td> <th scope="row"> Responsible AD </th> <td class="edit"> </td> <td> <span ><a title="Datatracker profile of Scott Hollenbeck" href="/person/shollenbeck@verisign.com" >Scott Hollenbeck</a> <a href="mailto:shollenbeck%40verisign.com" aria-label="Compose email to shollenbeck@verisign.com" title="Compose email to shollenbeck@verisign.com"> <i class="bi bi-envelope"></i></a></span> </td> </tr> <tr> <td></td> <th scope="row"> Send notices to </th> <td class="edit"> </td> <td> <a href="mailto:ned.freed@mrochek.com">ned.freed@mrochek.com</a>, <a href="mailto:paulo@turnpike.com">paulo@turnpike.com</a> </td> </tr> </tbody> </table> <div class="buttonlist"> <a class="btn btn-primary btn-sm" href="mailto:draft-ietf-drums-abnf@ietf.org?subject=Mail%20regarding%20draft-ietf-drums-abnf"> <i class="bi bi-envelope"> </i> Email authors </a> <a class="btn btn-primary btn-sm" href="mailto:drums@cs.utk.edu?subject=Mail%20regarding%20draft-ietf-drums-abnf"> <i class="bi bi-envelope"> </i> Email WG </a> <a class="btn btn-primary btn-sm" href="/ipr/search/?submit=draft&amp;id=draft-ietf-drums-abnf" rel="nofollow"> <i class="bi bi-lightning"> </i> IPR </a> <a class="btn btn-primary btn-sm" href="/doc/draft-ietf-drums-abnf/references/" rel="nofollow"> <i class="bi bi-arrow-left"> </i> References </a> <a class="btn btn-primary btn-sm" href="/doc/draft-ietf-drums-abnf/referencedby/" rel="nofollow"> <i class="bi bi-arrow-right"> </i> Referenced by </a> <a class="btn btn-primary btn-sm" href="https://author-tools.ietf.org/api/idnits?url=https://www.ietf.org/archive/id/draft-ietf-drums-abnf-04.txt" rel="nofollow" target="_blank"> <i class="bi bi-exclamation"> </i> Nits </a> <a class="btn btn-primary btn-sm" href="https://mailarchive.ietf.org/arch/search/?q=%22draft-ietf-drums-abnf%22" rel="nofollow" target="_blank"> <i class="bi bi-search"> </i> Search email archive </a> </div> <div class="card mt-5"> <div class="card-header"> draft-ietf-drums-abnf-04 </div> <div class="card-body"> <pre>Network Working Group D. Crocker (editor) Internet-Draft: DRAFT-DRUMS-ABNF-04.txt Internet Mail Expiration &lt;4/98&gt; Consortium Paul Overell Demon Internet Ltd Augmented BNF for Syntax Specifications: ABNF STATUS OF THIS MEMO This document is an Internet-Draft. Internet-Drafts are working documents of the Internet Engineering Task Force (IETF), its areas, and its working groups. Note that other groups may also distribute working documents as Internet-Drafts. Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet- Drafts as reference material or to cite them other than as ``work in progress.&#x27;&#x27; To learn the current status of any Internet-Draft, please check the ``1id-abstracts.txt&#x27;&#x27; listing contained in the Internet- Drafts Shadow Directories on ftp.is.co.za (Africa), nic.nordu.net (Europe), munnari.oz.au (Pacific Rim), ds.internic.net (US East Coast), or ftp.isi.edu (US West Coast). TABLE OF CONTENTS 1. INTRODUCTION 2. RULE DEFINITION 2.1 RULE NAMING 2.2 RULE FORM 2.3 END-OF-RULE 2.4 TERMINAL VALUES 2.5 EXTERNAL ENCODINGS 3. OPERATORS 3.1 CONCATENATION RULE1 RULE2 3.2 ALTERNATIVES RULE1 / RULE2 3.3 INCREMENTAL ALTERNATIVES RULE1 =/ RULE2 3.4 VALUE RANGE ALTERNATIVES %C##-## 3.5 SEQUENCE GROUP (RULE1 RULE2) 3.6 VARIABLE REPETITION *RULE 3.6 SPECIFIC REPETITION NRULE 3.7 OPTIONAL SEQUENCE [RULE] 3.8 ; COMMENT 3.8 OPERATOR PRECEDENCE 4. ABNF DEFINITION OF ABNF 5. APPENDIX A - CORE 6. ACKNOWLEDGMENTS 7. REFERENCES 8. CONTACT 1. INTRODUCTION Internet technical specifications often need to define a format 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 have come to be the common citations for defining ABNF. The current document separates out that definition, 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, lists, and value ranges. Appendix A (Core) supplies rule definitions 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 language defined in the body of this document, and separate from its formal status. 2. RULE DEFINITION 2.1 Rule Naming The name of a rule is simply the name itself; that is, a sequence of characters, beginning with an alphabetic character, and followed by a combination of alphabetics, digits and hyphens (dashes). RULE NAMES ARE CASE-INSENSITIVE. The names &lt;rulename&gt;, &lt;Rulename&gt;, &lt;RULENAME&gt; and &lt;rUlENamE&gt; all refer to the same rule. Unlike original BNF, angle brackets (&quot;&lt;&quot;, &quot;&gt;&quot;) are not required. However, angle brackets may be used around a rule reference whenever their presence will facilitate discerning the use of a rule name. This is typically restricted to rule name references in free-form prose, or to distinguish partial rules that combine into a string not separated by white space, such as shown in the discussion about repetition, below. 2.2 Rule Form A rule is defined by the following sequence: name = elements where &lt;name&gt; is the name of the rule and &lt;elements&gt; is one or more rule names or terminal specifications. The equal sign separates the name from the definition of the rule. The elements form a sequence of one or more rule names and/or value definitions, combined according to the various operators, defined in this document, such as alternative and repetition. 2.3 End-of-Rule Formally the grammar requires a one-token look-ahead to find the &quot;=&quot; token, which indicates that the previous token is the name of a new rule. For visual ease, rule definitions are left aligned. When a rule requires multiple lines, the continuation lines are indented. 2.4 Terminal Values Rules resolve into a string of terminal values, sometimes called characters. Values within ABNF are represented as decimal numbers. Hence, an ABNF parser processes a sequence of characters. Each character is represented as a decimal number. A string of values is in &quot;network byte order&quot; with the higher- valued bytes represented on the left-hand side and being sent over the network first. Terminals are specified by one or more numeric characters with the base interpretation of those characters indicated explicitly. The following bases are currently defined: b = binary d = decimal x = hexadecimal Hence: CR = %d13 CR = %x0D respectively specify the decimal and hexadecimal representation of [US-ASCII] for carriage return. A concatenated string of such values is specified compactly, using a period (&quot;.&quot;) to indicate separation of characters within that value. Hence: CRLF = %d13.10 ABNF permits specifying literal text string directly, enclosed in quotation-marks. Hence: command = &quot;command string&quot; Literal text strings are interpreted as a concatenated set of printable characters. ABNF STRINGS ARE CASE-INSENSITIVE AND THE CHARACTER SET FOR THESE STRINGS IS US-ASCII. Hence: rulename = &quot;abc&quot; and: rulename = &quot;aBc&quot; will match &quot;abc&quot;, &quot;Abc&quot;, &quot;aBc&quot;, &quot;abC&quot;, &quot;ABc&quot;, &quot;aBC&quot;, &quot;AbC&quot; and &quot;ABC&quot;. TO SPECIFY A RULE WHICH IS CASE SENSITIVE, SPECIFY THE CHARACTERS INDIVIDUALLY. For example: rulename = %d97 %d9 %d99 or rulename = %d97.98.99 will match only the string which comprises only lowercased characters, abc. 2.5 External Encodings External representations of these characters will vary according to constraints in the storage or transmission environment. Hence, the same ABNF-based grammar may have multiple external encodings, such as one for a 7-bit US-ASCII environment, another for a binary octet environment and still a different one when 16- bit Unicode is used. Encoding details are beyond the scope of ABNF, although Appendix A (Core) provides definitions for a 7-bit US-ASCII environment as has been common to much of the Internet. By separating external encoding from the syntax, it is intended that alternate encoding environments can be used for the same syntax. 3. OPERATORS 3.1 Concatenation Rule1 Rule2 A rule can define a simple, ordered string of values -- i.e., a concatenation of contiguous characters -- by listing a sequence of rule names. For example: foo = %x61 ; a bar = %x62 ; b mumble = foo bar foo So that the rule &lt;mumble&gt; matches the lower-case string &quot;aba&quot;. LINEAR WHITE SPACE: Concatenation is at the core of the ABNF parsing model. A string of contiguous characters (values) is parsed according to the rules defined in ABNF. For Internet specifications, there is some history of permitting linear white space (space and horizontal tab) to be freely - and implicitly - interspered around major constructs, such as delimiting special characters or atomic strings. THIS SPECIFICATION FOR ABNF DOES NOT PROVIDE FOR IMPLICIT SPECIFICATION OF LINEAR WHITE SPACE Any grammar which wishes to permit linear white space around delimiters or string segments must specify it explicitly. It is often useful to provide for such white space in &quot;core&quot; rules that are then used variously among higher-level rules. The &quot;core&quot; rules might be formed into a lexical analyzer or simply be part of the main ruleset. 3.2 Alternatives Rule1 / Rule2 Elements separated by forward slash (&quot;/&quot;) are alternatives. Therefore, foo / bar will accept &lt;foo&gt; or &lt;bar&gt;. REMINDER: A string containing alphabetic characters is a non-terminal representing the set of combinatorial strings with upper and lower case characters. 3.3 Incremental Alternatives Rule1 =/ Rule2 It is sometimes convenient to specify a list of alternatives in fragments. That is, an initial rule may match one or more alternatives, with later rule definitions adding to the set of alternatives. This is particularly useful for otherwise- independent specifications which derive from the same parent rule set, such as often occurs with parameter lists. ABNF permits this incremental definition through the construct: oldrule =/ additional-alternatives So that the rule set ruleset = alt1 / alt2 ruleset =/ alt3 ruleset =/ alt4 / alt5 is the same as specifying ruleset = alt1 / alt2 / alt3 / alt4 / alt5 3.4 Value Range Alternatives %c##-## A range of alternative numeric values can be specified compactly, using dash (&quot;-&quot;) to indicate the range of alternative values. Hence: DIGIT = %x30-39 is equivalent to: DIGIT = &quot;0&quot; / &quot;1&quot; / &quot;2&quot; / &quot;3&quot; / &quot;4&quot; / &quot;5&quot; / &quot;6&quot; / &quot;7&quot; / &quot;8&quot; / &quot;9&quot; Concatenated numeric values and numeric value ranges can not be specified in the same string. A numeric value may use the dotted notation for concatenation or it may use the dash notation to specify one value range. Hence, to specify a line containing one printable character, the specification could be: onechar-line = %x0D.OA %x20-7E %xOD.OA 3.5 Sequence Group (Rule1 Rule2) Elements enclosed in parentheses are treated as a single element, whose contents are STRICTLY ORDERED. Thus, elem (foo / bar) blat which matches (elem foo blat) or (elem bar blat). elem foo / bar blat matches (elem foo) or (bar blat). IT IS STRONGLY ADVISED TO USE GROUPING NOTATION, RATHER THAN TO RELY ON PROPER READING OF &quot;BARE&quot; ALTERNATIONS, WHEN ALTERNATIVES CONSIST OF MULTIPLE RULE NAMES OR LITERALS. Hence it is strongly recommended that instead of the above form, the form: (elem foo) / (bar blat) be used. It will avoid misinterpretation by casual readers. The local grouping notation is also used within free text to set off an element sequence from the prose. 3.6 Variable Repetition *Rule The operator &quot;*&quot; preceding an element indicates repetition. The full form is: &lt;a&gt;*&lt;b&gt;element where &lt;a&gt; and &lt;b&gt; are optional decimal values, indicating at least &lt;a&gt; and at most &lt;b&gt; occurrences of element. Default values are 0 and infinity so that &lt;*element&gt; allows any number, including zero; &lt;1*element&gt; requires at least one; &lt;3*3element&gt; allows exactly 3 and &lt;1*2element&gt; allows one or two. 3.7 Specific Repetition nRule A rule of the form: &lt;n&gt;element is equivalent to &lt;n&gt;*&lt;n&gt;element That is, exactly &lt;N&gt; occurrences of &lt;element&gt;. Thus 2DIGIT is a 2-digit number, and 3ALPHA is a string of three alphabetic characters. 3.8 Optional Sequence [RULE] Square brackets enclose an optional element sequence: [foo bar] is equivalent to *1(foo bar). 3.9 ; Comment A semi-colon starts a comment that continues to the end of line. This is a simple way of including useful notes in parallel with the specifications. 3.10 Operator Precedence The various mechanisms described above have the following precedence, from highest (binding tightest) at the top, to lowest and loosest at the bottom: Strings, Names formation Comment Value range Repetition, List Grouping, Optional Concatenation Alternative Use of the alternative operator, freely mixed with concatenations can be confusing. IT IS STRONGLY RECOMMENDED THAT THE GROUPING OPERATOR BE USED TO MAKE EXPLICIT CONCATENATION GROUPS. 4. ABNF DEFINITION OF ABNF This syntax uses the rules provided in Appendix A (Core). rulelist = 1*( rule / (*c-wsp c-nl) ) rule = rulename defined-as elements c-nl ; continues if next line starts ; with white space rulename = ALPHA *(ALPHA / DIGIT / &quot;-&quot;) defined-as = *c-wsp (&quot;=&quot; / &quot;=/&quot;) *c-wsp ; basic rules definition and ; incremental alternatives elements = alternation *c-wsp c-wsp = WSP / (c-nl WSP) c-nl = comment / CRLF ; comment or newline comment = &quot;;&quot; *(WSP / VCHAR) CRLF alternation = concatenation *(*c-wsp &quot;/&quot; *c-wsp concatenation) concatenation = repetition *(1*c-wsp repetition) repetition = [repeat] element repeat = 1*DIGIT / (*DIGIT &quot;*&quot; *DIGIT) element = rulename / group / option / char-val / num-val / prose-val group = &quot;(&quot; *c-wsp alternation *c-wsp &quot;)&quot; option = &quot;[&quot; *c-wsp alternation *c-wsp &quot;]&quot; char-val = DQUOTE *(%x20-21 / %x23-7E) DQUOTE ; quoted string of SP and VCHAR without DQUOTE num-val = &quot;%&quot; (bin-val / dec-val / hex-val) bin-val = &quot;b&quot; 1*BIT *(&quot;.&quot; 1*BIT) / [&quot;-&quot; 1*BIT] ; series of concatenated bit values ; or single ONEOF range dec-val = &quot;d&quot; 1*DIGIT *(&quot;.&quot; 1*DIGIT) / [&quot;-&quot; 1*DIGIT] hex-val = &quot;x&quot; 1*HEXDIG *(&quot;.&quot; 1*HEXDIG) / [&quot;-&quot; 1*HEXDIG] prose-val = &quot;&lt;&quot; *(%x20-3D / %x3F-7E) &quot;&gt;&quot; ; bracketed string of SP and VCHAR without angles 5. SECURITY CONSIDERATIONS Security is truly believed to be irrelevant to this document. 6. APPENDIX A - CORE This Appendix is provided as a convenient core for specific grammars. The definitions may be used as a core set of rules. Certain basic rules are in uppercase, such as SP, HTAB, CRLF, DIGIT, ALPHA, etc. ALPHA = %x41-5A / %x61-7A ; A-Z / a-z BIT = &quot;0&quot; / &quot;1&quot; CHAR = %x01-7F ; any 7-bit US-ASCII character, excluding NUL CR = %x0D ; carriage return CRLF = CR LF ; Internet standard newline CTL = %x00-1F / %x7F ; controls DIGIT = %x30-39 ; 0-9 DQUOTE = %x22 ; &quot; (Double Quote) HEXDIG = DIGIT / &quot;A&quot; / &quot;B&quot; / &quot;C&quot; / &quot;D&quot; / &quot;E&quot; / &quot;F&quot; HTAB = %x09 ; horizontal tab LF = %x0A ; linefeed LWSP = *(WSP / CRLF WSP) ; linear white space (past newline) OCTET = %x00-FF ; 8 bits of data SP = %x20 ; space VCHAR = %x21-7E ; visible (printing) characters WSP = SP / HTAB ; white space Externally, data are represented as &quot;network virtual ASCII&quot;, namely 7-bit US-ASCII in an 8th bit field, with the high (8th) bit set to zero. 7. ACKNOWLEDGMENTS The syntax for ABNF was originally specified in RFC #733. Ken L. Harrenstien, of SRI International, was responsible for re-coding the BNF into an augmented BNF that makes the representation smaller and easier to understand. This recent project began as a simple effort to cull out the portion of RFC 822 which has been repeatedly cited by non-email specification writers, namely the description of augmented BNF. Rather than simply and blindly converting the existing text into a separate document, the working group chose to give careful consideration to the deficiencies, as well as benefits, of the existing specification and related specifications available over the last 15 years and therefore to pursue enhancement. This turned the project into something rather more ambitious than first intended. Interestingly the result is not massively different from that original, although decisions such as removing the list notation came as a surprise. The current round of specification was part of the DRUMS working group, with significant contributions from Roger Fajman, Bill McQuillan, Keith Moore, Pete Resnick, Jerome Abela and Chris Newman. 8. REFERENCES [US-ASCII] Coded Character Set--7-Bit American Standard Code for Information Interchange, ANSI X3.4-1986. [RFC733] Crocker, D.H., Vittal, J.J., Pogran, K.T., Henderson, D.A. &quot;Standard for the Format of ARPA Network Text Message,&quot; RFC 733, November 1977. [RFC822] Crocker, D., &quot;Standard for the Format of ARPA Internet Text Messages&quot;, RFC 822, August, 1982. 9. CONTACT David H. Crocker Paul Overell Internet Mail Consortium Demon Internet Ltd 675 Spruce Dr. Dorking Business Park Sunnyvale, CA 94086 USA Dorking Surrey, RH4 1HN &lt;dcrocker@imc.org&gt; UK Phone: +1 408 246 8253 &lt;paulo@turnpike.com&gt; Fax: +1 408 249 6205 </pre> </div> </div> </div> </div> </main> <footer class="col-md-12 col-sm-12 border-top mt-5 py-5 bg-light-subtle text-center position-sticky"> <a href="https://www.ietf.org/" class="p-3">IETF</a> <a href="https://www.ietf.org/iesg/" class="p-3">IESG</a> <a href="https://www.iab.org/" class="p-3">IAB</a> <a href="https://www.irtf.org/" class="p-3">IRTF</a> <a href="https://www.ietf.org/llc/" class="p-3 text-nowrap">IETF LLC</a> <a href="https://trustee.ietf.org/" class="p-3 text-nowrap">IETF Trust</a> <a href="https://www.rfc-editor.org/" class="p-3 text-nowrap">RFC Editor</a> <a href="https://www.iana.org/" class="p-3">IANA</a> <a href="https://www.ietf.org/privacy-statement/" class="p-3 text-nowrap">Privacy Statement</a> <div class="small text-body-secondary py-3"> <a class="mx-2" href="/release/about">About IETF Datatracker</a> <span class="mx-2"> <a href="https://github.com/ietf-tools/datatracker/releases/tag/12.28.2"> Version 12.28.2 (release - 7ecf23e) </a> </span> <a class="mx-2" href="https://status.ietf.org" target="_blank">System Status</a> <span class="mx-2 text-danger"> <i class="bi bi-bug"></i> Report a bug: <a class="text-reset" target="_blank" href="https://github.com/ietf-tools/datatracker/issues/new/choose">GitHub</a> <a class="text-reset" href="mailto:tools-help@ietf.org">Email</a> </span> </div> </footer> <script src="https://static.ietf.org/dt/12.28.2/ietf/js/d3.js"> </script> <script src="https://static.ietf.org/dt/12.28.2/ietf/js/document_timeline.js"> </script> <script src="https://static.ietf.org/dt/12.28.2/ietf/js/select2.js"></script> <script> $('#navbar-doc-search').on('select2:select', function (e) { window.location.href = e.params.data.url; }); </script> <script type="text/javascript"> var _paq = window._paq || []; _paq.push(['disableCookies']); _paq.push(['trackPageView']); _paq.push(['enableLinkTracking']); (function() { var u="//analytics.ietf.org/"; _paq.push(['setTrackerUrl', u+'matomo.php']); _paq.push(['setSiteId', 7]); var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s); })(); </script> <noscript><p><img src="//analytics.ietf.org/piwik.php?idsite=7" style="border:0;" alt="" /></p></noscript> <script>(function(){function c(){var b=a.contentDocument||a.contentWindow.document;if(b){var d=b.createElement('script');d.innerHTML="window.__CF$cv$params={r:'8e7aa7e30ea4ce1d',t:'MTczMjQ2NDQ4Ny4wMDAwMDA='};var a=document.createElement('script');a.nonce='';a.src='/cdn-cgi/challenge-platform/scripts/jsd/main.js';document.getElementsByTagName('head')[0].appendChild(a);";b.getElementsByTagName('head')[0].appendChild(d)}}if(document.body){var a=document.createElement('iframe');a.height=1;a.width=1;a.style.position='absolute';a.style.top=0;a.style.left=0;a.style.border='none';a.style.visibility='hidden';document.body.appendChild(a);if('loading'!==document.readyState)c();else if(window.addEventListener)document.addEventListener('DOMContentLoaded',c);else{var e=document.onreadystatechange||function(){};document.onreadystatechange=function(b){e(b);'loading'!==document.readyState&&(document.onreadystatechange=e,c())}}}})();</script></body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10