source: draft-ietf-httpbis/orig/rfc4234.html @ 978

Last change on this file since 978 was 978, checked in by julian.reschke@…, 9 years ago

regen HTML using latest version of xslt

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/html
File size: 42.3 KB
Line 
1<!DOCTYPE html
2  PUBLIC "-//W3C//DTD HTML 4.01//EN">
3<html lang="en">
4   <head profile="http://www.w3.org/2006/03/hcard http://dublincore.org/documents/2008/08/04/dc-html/">
5      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
6      <title>Augmented BNF for Syntax Specifications: ABNF</title><style type="text/css" title="Xml2Rfc (sans serif)">
7a {
8  text-decoration: none;
9}
10a.smpl {
11  color: black;
12}
13a:hover {
14  text-decoration: underline;
15}
16a:active {
17  text-decoration: underline;
18}
19address {
20  margin-top: 1em;
21  margin-left: 2em;
22  font-style: normal;
23}
24body {
25  color: black;
26  font-family: verdana, helvetica, arial, sans-serif;
27  font-size: 10pt;
28}
29cite {
30  font-style: normal;
31}
32dd {
33  margin-right: 2em;
34}
35dl {
36  margin-left: 2em;
37}
38
39ul.empty {
40  list-style-type: none;
41}
42ul.empty li {
43  margin-top: .5em;
44}
45dl p {
46  margin-left: 0em;
47}
48dt {
49  margin-top: .5em;
50}
51h1 {
52  font-size: 14pt;
53  line-height: 21pt;
54  page-break-after: avoid;
55}
56h1.np {
57  page-break-before: always;
58}
59h1 a {
60  color: #333333;
61}
62h2 {
63  font-size: 12pt;
64  line-height: 15pt;
65  page-break-after: avoid;
66}
67h3, h4, h5, h6 {
68  font-size: 10pt;
69  page-break-after: avoid;
70}
71h2 a, h3 a, h4 a, h5 a, h6 a {
72  color: black;
73}
74img {
75  margin-left: 3em;
76}
77li {
78  margin-left: 2em;
79  margin-right: 2em;
80}
81ol {
82  margin-left: 2em;
83  margin-right: 2em;
84}
85ol p {
86  margin-left: 0em;
87}
88p {
89  margin-left: 2em;
90  margin-right: 2em;
91}
92pre {
93  margin-left: 3em;
94  background-color: lightyellow;
95  padding: .25em;
96}
97pre.text2 {
98  border-style: dotted;
99  border-width: 1px;
100  background-color: #f0f0f0;
101  width: 69em;
102}
103pre.inline {
104  background-color: white;
105  padding: 0em;
106}
107pre.text {
108  border-style: dotted;
109  border-width: 1px;
110  background-color: #f8f8f8;
111  width: 69em;
112}
113pre.drawing {
114  border-style: solid;
115  border-width: 1px;
116  background-color: #f8f8f8;
117  padding: 2em;
118}
119table {
120  margin-left: 2em;
121}
122table.header {
123  border-spacing: 1px;
124  width: 95%;
125  font-size: 10pt;
126  color: white;
127}
128td.top {
129  vertical-align: top;
130}
131td.topnowrap {
132  vertical-align: top;
133  white-space: nowrap; 
134}
135table.header td {
136  background-color: gray;
137  width: 50%;
138}
139table.header a {
140  color: white;
141}
142td.reference {
143  vertical-align: top;
144  white-space: nowrap;
145  padding-right: 1em;
146}
147thead {
148  display:table-header-group;
149}
150ul.toc {
151  list-style: none;
152  margin-left: 1.5em;
153  margin-right: 0em;
154  padding-left: 0em;
155}
156li.tocline0 {
157  line-height: 150%;
158  font-weight: bold;
159  font-size: 10pt;
160  margin-left: 0em;
161  margin-right: 0em;
162}
163li.tocline1 {
164  line-height: normal;
165  font-weight: normal;
166  font-size: 9pt;
167  margin-left: 0em;
168  margin-right: 0em;
169}
170li.tocline2 {
171  font-size: 0pt;
172}
173ul p {
174  margin-left: 0em;
175}
176
177.comment {
178  background-color: yellow;
179}
180.center {
181  text-align: center;
182}
183.error {
184  color: red;
185  font-style: italic;
186  font-weight: bold;
187}
188.figure {
189  font-weight: bold;
190  text-align: center;
191  font-size: 9pt;
192}
193.filename {
194  color: #333333;
195  font-weight: bold;
196  font-size: 12pt;
197  line-height: 21pt;
198  text-align: center;
199}
200.fn {
201  font-weight: bold;
202}
203.hidden {
204  display: none;
205}
206.left {
207  text-align: left;
208}
209.right {
210  text-align: right;
211}
212.title {
213  color: #990000;
214  font-size: 18pt;
215  line-height: 18pt;
216  font-weight: bold;
217  text-align: center;
218  margin-top: 36pt;
219}
220.vcardline {
221  display: block;
222}
223.warning {
224  font-size: 14pt;
225  background-color: yellow;
226}
227
228
229@media print {
230  .noprint {
231    display: none;
232  }
233 
234  a {
235    color: black;
236    text-decoration: none;
237  }
238
239  table.header {
240    width: 90%;
241  }
242
243  td.header {
244    width: 50%;
245    color: black;
246    background-color: white;
247    vertical-align: top;
248    font-size: 12pt;
249  }
250
251  ul.toc a::after {
252    content: leader('.') target-counter(attr(href), page);
253  }
254 
255  a.iref {
256    content: target-counter(attr(href), page);
257  }
258 
259  .print2col {
260    column-count: 2;
261    -moz-column-count: 2;
262    column-fill: auto;
263  }
264}
265
266@page {
267  @top-left {
268       content: "RFC 4234"; 
269  } 
270  @top-right {
271       content: "October 2005"; 
272  } 
273  @top-center {
274       content: "ABNF"; 
275  } 
276  @bottom-left {
277       content: "Crocker & Overell"; 
278  } 
279  @bottom-center {
280       content: "Standards Track"; 
281  } 
282  @bottom-right {
283       content: "[Page " counter(page) "]"; 
284  } 
285}
286
287@page:first { 
288    @top-left {
289      content: normal;
290    }
291    @top-right {
292      content: normal;
293    }
294    @top-center {
295      content: normal;
296    }
297}
298</style><link rel="Contents" href="#rfc.toc">
299      <link rel="Author" href="#rfc.authors">
300      <link rel="Copyright" href="#rfc.copyright">
301      <link rel="Chapter" title="1 INTRODUCTION" href="#rfc.section.1">
302      <link rel="Chapter" title="2 RULE DEFINITION" href="#rfc.section.2">
303      <link rel="Chapter" title="3 OPERATORS" href="#rfc.section.3">
304      <link rel="Chapter" title="4 ABNF DEFINITION OF ABNF" href="#rfc.section.4">
305      <link rel="Chapter" title="5 SECURITY CONSIDERATIONS" href="#rfc.section.5">
306      <link rel="Chapter" href="#rfc.section.6" title="6 References">
307      <link rel="Appendix" title="A ACKNOWLEDGEMENTS" href="#rfc.section.A">
308      <link rel="Appendix" title="B APPENDIX - CORE ABNF OF ABNF" href="#rfc.section.B">
309      <link rel="Alternate" title="Authorative ASCII Version" href="http://www.ietf.org/rfc/rfc4234.txt">
310      <link rel="Help" title="Additional Information on tools.ietf.org" href="http://tools.ietf.org/html/rfc4234">
311      <meta name="generator" content="http://greenbytes.de/tech/webdav/rfc2629.xslt, Revision 1.520, 2010-07-14 12:36:35, XSLT vendor: SAXON 8.9 from Saxonica http://www.saxonica.com/">
312      <meta name="keywords" content="ABNF, Augmented, Backus-Naur, Form, electronic, mail">
313      <link rel="schema.dct" href="http://purl.org/dc/terms/">
314      <meta name="dct.creator" content="Crocker, D.">
315      <meta name="dct.creator" content="Overell, P.">
316      <meta name="dct.identifier" content="urn:ietf:rfc:4234">
317      <meta name="dct.issued" scheme="ISO8601" content="2005-10">
318      <meta name="dct.replaces" content="urn:ietf:rfc:2234">
319      <meta name="dct.abstract" content="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.">
320      <meta name="dct.isPartOf" content="urn:issn:2070-1721">
321      <meta name="description" content="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.">
322   </head>
323   <body>
324      <table class="header">
325         <tbody>
326            <tr>
327               <td class="left">Network Working Group</td>
328               <td class="right">D. Crocker, Editor</td>
329            </tr>
330            <tr>
331               <td class="left">Request for Comments: 4234</td>
332               <td class="right">Brandenburg InternetWorking</td>
333            </tr>
334            <tr>
335               <td class="left">Obsoletes: <a href="http://tools.ietf.org/html/rfc2234">2234</a></td>
336               <td class="right">P. Overell</td>
337            </tr>
338            <tr>
339               <td class="left">Category: Standards Track</td>
340               <td class="right">THUS plc.</td>
341            </tr>
342            <tr>
343               <td class="left"></td>
344               <td class="right">October 2005</td>
345            </tr>
346         </tbody>
347      </table>
348      <p class="title">Augmented BNF for Syntax Specifications: ABNF</p>
349      <h1><a id="rfc.status" href="#rfc.status">Status of this Memo</a></h1>
350      <p>This document specifies an Internet standards track protocol for the Internet community, and requests discussion and suggestions
351         for improvements. Please refer to the current edition of the “Internet Official Protocol Standards” (STD 1) for the standardization
352         state and status of this protocol. Distribution of this memo is unlimited.
353      </p>
354      <h1><a id="rfc.copyrightnotice" href="#rfc.copyrightnotice">Copyright Notice</a></h1>
355      <p>Copyright © The Internet Society (2005). All Rights Reserved.</p>
356      <h1 id="rfc.abstract"><a href="#rfc.abstract">Abstract</a></h1> 
357      <p>Internet technical specifications often need to define a formal syntax. Over the years, a modified version of Backus-Naur
358         Form (BNF), called Augmented BNF (ABNF), has been popular among many Internet specifications. The current specification documents
359         ABNF. It balances compactness and simplicity, with reasonable representational power. The differences between standard BNF
360         and ABNF involve naming rules, repetition, alternatives, order- independence, and value ranges. This specification also supplies
361         additional rule definitions and encoding for a core lexical analyzer of the type common to several Internet specifications.
362      </p> 
363      <hr class="noprint">
364      <h1 class="np" id="rfc.toc"><a href="#rfc.toc">Table of Contents</a></h1>
365      <ul class="toc">
366         <li class="tocline0">1.&nbsp;&nbsp;&nbsp;<a href="#rfc.section.1">INTRODUCTION</a></li>
367         <li class="tocline0">2.&nbsp;&nbsp;&nbsp;<a href="#rfc.section.2">RULE DEFINITION</a><ul class="toc">
368               <li class="tocline1">2.1.&nbsp;&nbsp;&nbsp;<a href="#rfc.section.2.1">Rule Naming</a></li>
369               <li class="tocline1">2.2.&nbsp;&nbsp;&nbsp;<a href="#rfc.section.2.2">Rule Form</a></li>
370               <li class="tocline1">2.3.&nbsp;&nbsp;&nbsp;<a href="#rfc.section.2.3">Terminal Values</a></li>
371               <li class="tocline1">2.4.&nbsp;&nbsp;&nbsp;<a href="#rfc.section.2.4">External Encodings</a></li>
372            </ul>
373         </li>
374         <li class="tocline0">3.&nbsp;&nbsp;&nbsp;<a href="#rfc.section.3">OPERATORS</a><ul class="toc">
375               <li class="tocline1">3.1.&nbsp;&nbsp;&nbsp;<a href="#rfc.section.3.1">Concatenation:  Rule1 Rule2</a></li>
376               <li class="tocline1">3.2.&nbsp;&nbsp;&nbsp;<a href="#Alternatives">Alternatives:  Rule1 / Rule2</a></li>
377               <li class="tocline1">3.3.&nbsp;&nbsp;&nbsp;<a href="#Incremental">Incremental Alternatives: Rule1 =/ Rule2</a></li>
378               <li class="tocline1">3.4.&nbsp;&nbsp;&nbsp;<a href="#Range">Value Range Alternatives:  %c##-##</a></li>
379               <li class="tocline1">3.5.&nbsp;&nbsp;&nbsp;<a href="#Sequence">Sequence Group:  (Rule1 Rule2)</a></li>
380               <li class="tocline1">3.6.&nbsp;&nbsp;&nbsp;<a href="#VarRep">Variable Repetition:  *Rule</a></li>
381               <li class="tocline1">3.7.&nbsp;&nbsp;&nbsp;<a href="#SpecRep">Specific Repetition:  nRule</a></li>
382               <li class="tocline1">3.8.&nbsp;&nbsp;&nbsp;<a href="#OptSeq">Optional Sequence:  [RULE]</a></li>
383               <li class="tocline1">3.9.&nbsp;&nbsp;&nbsp;<a href="#Comment">Comment:  ; Comment</a></li>
384               <li class="tocline1">3.10.&nbsp;&nbsp;&nbsp;<a href="#rfc.section.3.10">Operator Precedence</a></li>
385            </ul>
386         </li>
387         <li class="tocline0">4.&nbsp;&nbsp;&nbsp;<a href="#rfc.section.4">ABNF DEFINITION OF ABNF</a></li>
388         <li class="tocline0">5.&nbsp;&nbsp;&nbsp;<a href="#rfc.section.5">SECURITY CONSIDERATIONS</a></li>
389         <li class="tocline0">6.&nbsp;&nbsp;&nbsp;<a href="#rfc.references">References</a><ul class="toc">
390               <li class="tocline1">6.1.&nbsp;&nbsp;&nbsp;<a href="#rfc.references.1">Normative References</a></li>
391               <li class="tocline1">6.2.&nbsp;&nbsp;&nbsp;<a href="#rfc.references.2">Informative References</a></li>
392            </ul>
393         </li>
394         <li class="tocline0"><a href="#rfc.authors">Authors' Addresses</a></li>
395         <li class="tocline0">A.&nbsp;&nbsp;&nbsp;<a href="#rfc.section.A">ACKNOWLEDGEMENTS</a></li>
396         <li class="tocline0">B.&nbsp;&nbsp;&nbsp;<a href="#CORE">APPENDIX - CORE ABNF OF ABNF</a><ul class="toc">
397               <li class="tocline1">B.1.&nbsp;&nbsp;&nbsp;<a href="#rfc.section.B.1">Core Rules</a></li>
398               <li class="tocline1">B.2.&nbsp;&nbsp;&nbsp;<a href="#rfc.section.B.2">Common Encoding</a></li>
399            </ul>
400         </li>
401         <li class="tocline0"><a href="#rfc.ipr">Intellectual Property and Copyright Statements</a></li>
402      </ul>
403      <h1 id="rfc.section.1" class="np"><a href="#rfc.section.1">1.</a>&nbsp;INTRODUCTION
404      </h1>
405      <p id="rfc.section.1.p.1">Internet technical specifications often need to define a formal syntax and are free to employ whatever notation their authors
406         deem useful. Over the years, a modified version of Backus-Naur Form (BNF), called Augmented BNF (ABNF), has been popular among
407         many Internet specifications. It balances compactness and simplicity, with reasonable representational power. In the early
408         days of the Arpanet, each specification contained its own definition of ABNF. This included the email specifications, <a href="#RFC733"><cite title="Standard for the format of ARPA network text messages">[RFC733]</cite></a> and then <a href="#RFC822"><cite title="Standard for the format of ARPA Internet text messages">[RFC822]</cite></a>, which came to be the common citations for defining ABNF. The current document separates those definitions to permit selective
409         reference. Predictably, it also provides some modifications and enhancements.
410      </p>
411      <p id="rfc.section.1.p.2">The differences between standard BNF and ABNF involve naming rules, repetition, alternatives, order-independence, and value
412         ranges. <a href="#CORE" title="APPENDIX - CORE ABNF OF ABNF">Appendix&nbsp;B</a> supplies rule definitions and encoding for a core lexical analyzer of the type common to several Internet specifications.
413         It is provided as a convenience and is otherwise separate from the meta language defined in the body of this document, and
414         separate from its formal status.
415      </p>
416      <dl>
417         <dt>Changes since [RFC2234]:</dt>
418         <dd>In <a href="#SpecRep" title="Specific Repetition:  nRule">Section&nbsp;3.7</a>, the phrase: "That is, exactly &lt;N&gt; occurrences of &lt;element&gt;." was corrected to: "That is, exactly &lt;n&gt; occurrences of &lt;element&gt;."
419         </dd>
420         <dd>Some continuation comment lines needed to be corrected to begin with comment character (";").</dd>
421      </dl>
422      <h1 id="rfc.section.2"><a href="#rfc.section.2">2.</a>&nbsp;RULE DEFINITION
423      </h1>
424      <h2 id="rfc.section.2.1"><a href="#rfc.section.2.1">2.1.</a>&nbsp;Rule Naming
425      </h2>
426      <p id="rfc.section.2.1.p.1">The name of a rule is simply the name itself; that is, a sequence of characters, beginning with an alphabetic character, and
427         followed by a combination of alphabetics, digits, and hyphens (dashes).
428      </p>
429      <p id="rfc.section.2.1.p.2"> </p>
430      <dl>
431         <dt>NOTE:  </dt>
432         <dd>Rule names are case-insensitive</dd>
433      </dl>
434      <p id="rfc.section.2.1.p.3">The names &lt;rulename&gt;, &lt;Rulename&gt;, &lt;RULENAME&gt;, and &lt;rUlENamE&gt; all refer to the same rule.</p>
435      <p id="rfc.section.2.1.p.4">Unlike original BNF, angle brackets ("&lt;", "&gt;") are not required. However, angle brackets may be used around a rule name whenever
436         their presence facilitates in discerning the use of a rule name. This is typically restricted to rule name references in free-form
437         prose, or to distinguish partial rules that combine into a string not separated by white space, such as shown in the discussion
438         about repetition, below.
439      </p>
440      <h2 id="rfc.section.2.2"><a href="#rfc.section.2.2">2.2.</a>&nbsp;Rule Form
441      </h2>
442      <p id="rfc.section.2.2.p.1">A rule is defined by the following sequence:</p>
443      <div id="rfc.figure.u.1"></div> <pre class="text">
444      name =  elements crlf </pre> <p id="rfc.section.2.2.p.3">where &lt;name&gt; is the name of the rule, &lt;elements&gt; is one or more rule names or terminal specifications, and &lt;crlf&gt; is the end-of-line
445         indicator (carriage return followed by line feed). The equal sign separates the name from the definition of the rule. The
446         elements form a sequence of one or more rule names and/or value definitions, combined according to the various operators defined
447         in this document, such as alternative and repetition.
448      </p>
449      <p id="rfc.section.2.2.p.4">For visual ease, rule definitions are left aligned. When a rule requires multiple lines, the continuation lines are indented.
450         The left alignment and indentation are relative to the first lines of the ABNF rules and need not match the left margin of
451         the document.
452      </p>
453      <h2 id="rfc.section.2.3"><a href="#rfc.section.2.3">2.3.</a>&nbsp;Terminal Values
454      </h2>
455      <p id="rfc.section.2.3.p.1">Rules resolve into a string of terminal values, sometimes called characters. In ABNF, a character is merely a non-negative
456         integer. In certain contexts, a specific mapping (encoding) of values into a character set (such as ASCII) will be specified.
457      </p>
458      <div id="rfc.figure.u.2"></div> 
459      <p>Terminals are specified by one or more numeric characters, with the base interpretation of those characters indicated explicitly.
460         The following bases are currently defined:
461      </p>  <pre class="text">
462      b           =  binary
463
464      d           =  decimal
465
466      x           =  hexadecimal </pre> <div id="rfc.figure.u.3"></div> 
467      <p>Hence:</p>  <pre class="text">
468      CR          =  %d13
469
470      CR          =  %x0D </pre>  <p>respectively specify the decimal and hexadecimal representation of <a href="#US-ASCII"><cite title="Coded Character Set -- 7-bit American Standard Code for Information Interchange">[US-ASCII]</cite></a> for carriage return.
471      </p> 
472      <div id="rfc.figure.u.4"></div> 
473      <p>A concatenated string of such values is specified compactly, using a period (".") to indicate a separation of characters within
474         that value. Hence:
475      </p>  <pre class="text">
476      CRLF        =  %d13.10 </pre> <div id="rfc.figure.u.5"></div> 
477      <p>ABNF permits the specification of literal text strings directly, enclosed in quotation-marks. Hence:</p>  <pre class="text">
478      command     =  "command string" </pre> <p id="rfc.section.2.3.p.6">Literal text strings are interpreted as a concatenated set of printable characters.</p>
479      <p id="rfc.section.2.3.p.7"> </p>
480      <dl>
481         <dt>NOTE:  </dt>
482         <dd>ABNF strings are case-insensitive and the character set for these strings is us-ascii.</dd>
483      </dl>
484      <div id="rfc.figure.u.6"></div> 
485      <p>Hence:</p>  <pre class="text">
486      rulename = "abc" </pre> <div id="rfc.figure.u.7"></div> 
487      <p>and:</p>  <pre class="text">
488      rulename = "aBc"
489</pre>  <p>will match "abc", "Abc", "aBc", "abC", "ABc", "aBC", "AbC", and "ABC".</p> 
490      <p id="rfc.section.2.3.p.10"> </p>
491      <ul class="empty">
492         <li>To specify a rule that IS case SENSITIVE, specify the characters individually.</li>
493      </ul>
494      <div id="rfc.figure.u.8"></div> 
495      <p>For example:</p>  <pre class="text">
496      rulename    =  %d97 %d98 %d99
497</pre> <div id="rfc.figure.u.9"></div> 
498      <p>or</p>  <pre class="text">
499      rulename    =  %d97.98.99
500</pre>  <p>will match only the string that comprises only the lowercased characters, abc.</p> 
501      <h2 id="rfc.section.2.4"><a href="#rfc.section.2.4">2.4.</a>&nbsp;External Encodings
502      </h2>
503      <p id="rfc.section.2.4.p.1">External representations of terminal value characters will vary according to constraints in the storage or transmission environment.
504         Hence, the same ABNF-based grammar may have multiple external encodings, such as one for a 7-bit US-ASCII environment, another
505         for a binary octet environment, and still a different one when 16-bit Unicode is used. Encoding details are beyond the scope
506         of ABNF, although Appendix A (Core) provides definitions for a 7-bit US-ASCII environment as has been common to much of the
507         Internet.
508      </p>
509      <p id="rfc.section.2.4.p.2">By separating external encoding from the syntax, it is intended that alternate encoding environments can be used for the same
510         syntax.
511      </p>
512      <h1 id="rfc.section.3"><a href="#rfc.section.3">3.</a>&nbsp;OPERATORS
513      </h1>
514      <h2 id="rfc.section.3.1"><a href="#rfc.section.3.1">3.1.</a>&nbsp;Concatenation:  Rule1 Rule2
515      </h2>
516      <p id="rfc.section.3.1.p.1">A rule can define a simple, ordered string of values (i.e., a concatenation of contiguous characters) by listing a sequence
517         of rule names. For example:
518      </p>
519      <div id="rfc.figure.u.10"></div> <pre class="text">
520      foo         =  %x61           ; a
521
522      bar         =  %x62           ; b
523
524      mumble      =  foo bar foo </pre> <p id="rfc.section.3.1.p.3">So that the rule &lt;mumble&gt; matches the lowercase string "aba".</p>
525      <p id="rfc.section.3.1.p.4">LINEAR WHITE SPACE: Concatenation is at the core of the ABNF parsing model. A string of contiguous characters (values) is
526         parsed according to the rules defined in ABNF. For Internet specifications, there is some history of permitting linear white
527         space (space and horizontal tab) to be freely and implicitly interspersed around major constructs, such as delimiting special
528         characters or atomic strings.
529      </p>
530      <p id="rfc.section.3.1.p.5">NOTE: </p>
531      <ul class="empty">
532         <li>This specification for ABNF does not provide for implicit specification of linear white space.</li>
533      </ul>
534      <p id="rfc.section.3.1.p.6">Any grammar that wishes to permit linear white space around delimiters or string segments must specify it explicitly. It is
535         often useful to provide for such white space in "core" rules that are then used variously among higher-level rules. The "core"
536         rules might be formed into a lexical analyzer or simply be part of the main ruleset.
537      </p>
538      <h2 id="rfc.section.3.2"><a href="#rfc.section.3.2">3.2.</a>&nbsp;<a id="Alternatives" href="#Alternatives">Alternatives:  Rule1 / Rule2</a></h2>
539      <p id="rfc.section.3.2.p.1">Elements separated by a forward slash ("/") are alternatives. Therefore,</p>
540      <div id="rfc.figure.u.11"></div> <pre class="text">
541      foo / bar 
542</pre>  <p>will accept &lt;foo&gt; or &lt;bar&gt;.</p> 
543      <p id="rfc.section.3.2.p.3"> </p>
544      <dl>
545         <dt>NOTE:  </dt>
546         <dd>A quoted string containing alphabetic characters is a special form for specifying alternative characters and is interpreted
547            as a non-terminal representing the set of combinatorial strings with the contained characters, in the specified order but
548            with any mixture of upper and lower case.
549         </dd>
550      </dl>
551      <h2 id="rfc.section.3.3"><a href="#rfc.section.3.3">3.3.</a>&nbsp;<a id="Incremental" href="#Incremental">Incremental Alternatives: Rule1 =/ Rule2</a></h2>
552      <p id="rfc.section.3.3.p.1">It is sometimes convenient to specify a list of alternatives in fragments. That is, an initial rule may match one or more
553         alternatives, with later rule definitions adding to the set of alternatives. This is particularly useful for otherwise, independent
554         specifications that derive from the same parent rule set, such as often occurs with parameter lists. ABNF permits this incremental
555         definition through the construct:
556      </p>
557      <div id="rfc.figure.u.12"></div> <pre class="text">
558      oldrule     =/ additional-alternatives </pre> <div id="rfc.figure.u.13"></div> 
559      <p>So that the rule set</p>  <pre class="text">
560      ruleset     =  alt1 / alt2
561
562      ruleset     =/ alt3
563
564      ruleset     =/ alt4 / alt5 </pre> <div id="rfc.figure.u.14"></div> 
565      <p>is the same as specifying</p>  <pre class="text">
566      ruleset     =  alt1 / alt2 / alt3 / alt4 / alt5 </pre> <h2 id="rfc.section.3.4"><a href="#rfc.section.3.4">3.4.</a>&nbsp;<a id="Range" href="#Range">Value Range Alternatives:  %c##-##</a></h2>
567      <div id="rfc.figure.u.15"></div> 
568      <p>A range of alternative numeric values can be specified compactly, using dash ("-") to indicate the range of alternative values.
569         Hence:
570      </p>  <pre class="text">
571      DIGIT       =  %x30-39 </pre> <div id="rfc.figure.u.16"></div> 
572      <p>is equivalent to:</p>  <pre class="text">
573      DIGIT       =  "0" / "1" / "2" / "3" / "4" / "5" / "6" /
574
575                     "7" / "8" / "9" </pre> <div id="rfc.figure.u.17"></div> 
576      <p>Concatenated numeric values and numeric value ranges cannot be specified in the same string. A numeric value may use the dotted
577         notation for concatenation or it may use the dash notation to specify one value range. Hence, to specify one printable character
578         between end of line sequences, the specification could be:
579      </p>  <pre class="text">
580      char-line = %x0D.0A %x20-7E %x0D.0A </pre> <h2 id="rfc.section.3.5"><a href="#rfc.section.3.5">3.5.</a>&nbsp;<a id="Sequence" href="#Sequence">Sequence Group:  (Rule1 Rule2)</a></h2>
581      <div id="rfc.figure.u.18"></div> 
582      <p>Elements enclosed in parentheses are treated as a single element, whose contents are STRICTLY ORDERED. Thus,</p>  <pre class="text">
583      elem (foo / bar) blat
584</pre>  <p>matches (elem foo blat) or (elem bar blat), and</p> 
585      <div id="rfc.figure.u.19"></div> <pre class="text">
586      elem foo / bar blat
587</pre>  <p>matches (elem foo) or (bar blat).</p> 
588      <p id="rfc.section.3.5.p.3"> </p>
589      <dl>
590         <dt>NOTE:  </dt>
591         <dd>It is strongly advised that grouping notation be used, rather than relying on the proper reading of "bare" alternations, when
592            alternatives consist of multiple rule names or literals.
593         </dd>
594      </dl>
595      <div id="rfc.figure.u.20"></div> 
596      <p>Hence, it is recommended that the following form be used:</p>  <pre class="text">
597     (elem foo) / (bar blat)
598</pre>  <p>It will avoid misinterpretation by casual readers.</p> 
599      <p id="rfc.section.3.5.p.5">The sequence group notation is also used within free text to set off an element sequence from the prose.</p>
600      <h2 id="rfc.section.3.6"><a href="#rfc.section.3.6">3.6.</a>&nbsp;<a id="VarRep" href="#VarRep">Variable Repetition:  *Rule</a></h2>
601      <div id="rfc.figure.u.21"></div> 
602      <p>The operator "*" preceding an element indicates repetition. The full form is:</p>  <pre class="text">
603      &lt;a&gt;*&lt;b&gt;element
604</pre>  <p>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 the element.</p> 
605      <p id="rfc.section.3.6.p.2">Default values are 0 and infinity so that *&lt;element&gt; allows any number, including zero; 1*&lt;element&gt; requires at least one;
606         3*3&lt;element&gt; allows exactly 3 and 1*2&lt;element&gt; allows one or two.
607      </p>
608      <h2 id="rfc.section.3.7"><a href="#rfc.section.3.7">3.7.</a>&nbsp;<a id="SpecRep" href="#SpecRep">Specific Repetition:  nRule</a></h2>
609      <div id="rfc.figure.u.22"></div> 
610      <p>A rule of the form:</p>  <pre class="text">
611      &lt;n&gt;element </pre> <div id="rfc.figure.u.23"></div> 
612      <p>is equivalent to</p>  <pre class="text">
613      &lt;n&gt;*&lt;n&gt;element </pre> <p id="rfc.section.3.7.p.3">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
614         characters.
615      </p>
616      <h2 id="rfc.section.3.8"><a href="#rfc.section.3.8">3.8.</a>&nbsp;<a id="OptSeq" href="#OptSeq">Optional Sequence:  [RULE]</a></h2>
617      <div id="rfc.figure.u.24"></div> 
618      <p>Square brackets enclose an optional element sequence:</p>  <pre class="text">
619      [foo bar] </pre> <div id="rfc.figure.u.25"></div> 
620      <p>is equivalent to</p>  <pre class="text">
621      *1(foo bar). </pre> <h2 id="rfc.section.3.9"><a href="#rfc.section.3.9">3.9.</a>&nbsp;<a id="Comment" href="#Comment">Comment:  ; Comment</a></h2>
622      <p id="rfc.section.3.9.p.1">A semi-colon starts a comment that continues to the end of line. This is a simple way of including useful notes in parallel
623         with the specifications.
624      </p>
625      <h2 id="rfc.section.3.10"><a href="#rfc.section.3.10">3.10.</a>&nbsp;Operator Precedence
626      </h2>
627      <p id="rfc.section.3.10.p.1">The various mechanisms described above have the following precedence, from highest (binding tightest) at the top, to lowest
628         (loosest) at the bottom:
629      </p>
630      <ul class="empty">
631         <li>Strings, Names formation</li>
632         <li>Comment</li>
633         <li>Value range</li>
634         <li>Repetition</li>
635         <li>Grouping, Optional</li>
636         <li>Concatenation</li>
637         <li>Alternative</li>
638      </ul>
639      <p id="rfc.section.3.10.p.2">Use of the alternative operator, freely mixed with concatenations, can be confusing.</p>
640      <p id="rfc.section.3.10.p.3"> </p>
641      <ul class="empty">
642         <li>Again, it is recommended that the grouping operator be used to make explicit concatenation groups.</li>
643      </ul>
644      <h1 id="rfc.section.4"><a href="#rfc.section.4">4.</a>&nbsp;ABNF DEFINITION OF ABNF
645      </h1>
646      <p id="rfc.section.4.p.1"> </p>
647      <dl>
648         <dt>NOTES:</dt>
649         <dd> 
650            <ol>
651               <li>This syntax requires a formatting of rules that is relatively strict. Hence, the version of a ruleset included in a specification
652                  might need preprocessing to ensure that it can be interpreted by an ABNF parser.
653               </li>
654               <li>This syntax uses the rules provided in <a href="#CORE" title="APPENDIX - CORE ABNF OF ABNF">Appendix&nbsp;B</a> (Core).
655               </li>
656            </ol> 
657         </dd>
658      </dl>
659      <div id="rfc.figure.u.26"></div> <pre class="inline">
660      rulelist       =  1*( rule / (*c-wsp c-nl) )
661
662      rule           =  rulename defined-as elements c-nl
663                             ; continues if next line starts
664                             ;  with white space
665
666      rulename       =  ALPHA *(ALPHA / DIGIT / "-")
667
668      defined-as     =  *c-wsp ("=" / "=/") *c-wsp
669                             ; basic rules definition and
670                             ;  incremental alternatives
671
672      elements       =  alternation *c-wsp
673
674      c-wsp          =  WSP / (c-nl WSP)
675
676      c-nl           =  comment / CRLF
677                             ; comment or newline
678
679      comment        =  ";" *(WSP / VCHAR) CRLF
680
681      alternation    =  concatenation
682                        *(*c-wsp "/" *c-wsp concatenation)
683
684      concatenation  =  repetition *(1*c-wsp repetition)
685
686      repetition     =  [repeat] element
687
688      repeat         =  1*DIGIT / (*DIGIT "*" *DIGIT)
689
690      element        =  rulename / group / option /
691                        char-val / num-val / prose-val
692
693      group          =  "(" *c-wsp alternation *c-wsp ")"
694
695      option         =  "[" *c-wsp alternation *c-wsp "]"
696
697      char-val       =  DQUOTE *(%x20-21 / %x23-7E) DQUOTE
698                             ; quoted string of SP and VCHAR
699                             ;  without DQUOTE
700
701      num-val        =  "%" (bin-val / dec-val / hex-val)
702
703      bin-val        =  "b" 1*BIT
704                        [ 1*("." 1*BIT) / ("-" 1*BIT) ]
705                             ; series of concatenated bit values
706                             ;  or single ONEOF range
707
708      dec-val        =  "d" 1*DIGIT
709                        [ 1*("." 1*DIGIT) / ("-" 1*DIGIT) ]
710
711      hex-val        =  "x" 1*HEXDIG
712                        [ 1*("." 1*HEXDIG) / ("-" 1*HEXDIG) ]
713
714      prose-val      =  "&lt;" *(%x20-3D / %x3F-7E) "&gt;"
715                             ; bracketed string of SP and VCHAR
716                             ;  without angles
717                             ; prose description, to be used as
718                             ;  last resort
719</pre> <h1 id="rfc.section.5"><a href="#rfc.section.5">5.</a>&nbsp;SECURITY CONSIDERATIONS
720      </h1>
721      <p id="rfc.section.5.p.1">Security is truly believed to be irrelevant to this document.</p>
722      <h1 id="rfc.references"><a id="rfc.section.6" href="#rfc.section.6">6.</a> References
723      </h1>
724      <h2 id="rfc.references.1"><a href="#rfc.section.6.1" id="rfc.section.6.1">6.1.</a> Normative References
725      </h2>
726      <table> 
727         <tr>
728            <td class="reference"><b id="US-ASCII">[US-ASCII]</b></td>
729            <td class="top">American National Standards
730               Institute, “Coded Character Set -- 7-bit American Standard Code for Information Interchange”, ANSI&nbsp;X3.4, 1986.
731            </td>
732         </tr>
733      </table>
734      <h2 id="rfc.references.2"><a href="#rfc.section.6.2" id="rfc.section.6.2">6.2.</a> Informative References
735      </h2>
736      <table>     
737         <tr>
738            <td class="reference"><b id="RFC2234">[RFC2234]</b></td>
739            <td class="top">Crocker, D. and P. Overell, “<a href="http://tools.ietf.org/html/rfc2234">Augmented BNF for Syntax Specifications: ABNF</a>”, RFC&nbsp;2234, November&nbsp;1997.
740            </td>
741         </tr>
742         <tr>
743            <td class="reference"><b id="RFC733">[RFC733]</b></td>
744            <td class="top"><a href="mailto:DCrocker@Rand-Unix" title="The Rand Corporation, Information Sciences&#xA;                     Department">Crocker, D.</a>, <a href="mailto:Vittal@BBN-TenexD" title="Bolt Beranek and Newman Inc. (BBN)">Vittal, J.</a>, <a href="mailto:Pogran@MIT-Multics" title="Massachusets Institute of Technology (MIT),&#xA;                     Laboratory for Computer Science">Pogran, K.</a>, and <a href="mailto:Henderson@BBN-TenexD" title="Bolt Beranek and Newman Inc. (BBN)">D. Henderson</a>, “<a href="http://tools.ietf.org/html/rfc733">Standard for the format of ARPA network text messages</a>”, RFC&nbsp;733, November&nbsp;1977.
745            </td>
746         </tr>
747         <tr>
748            <td class="reference"><b id="RFC822">[RFC822]</b></td>
749            <td class="top"><a href="mailto:DCrocker@UDel-Relay" title="University of Delaware, Dept. of Electrical&#xA;                     Engineering">Crocker, D.</a>, “<a href="http://tools.ietf.org/html/rfc822">Standard for the format of ARPA Internet text messages</a>”, STD&nbsp;11, RFC&nbsp;822, August&nbsp;1982.
750            </td>
751         </tr>
752      </table>
753      <div class="avoidbreak">
754         <h1 id="rfc.authors"><a href="#rfc.authors">Authors' Addresses</a></h1>
755         <address class="vcard"><span class="vcardline"><span class="fn">Dave Crocker</span>
756               (editor)
757               <span class="n hidden"><span class="family-name">Crocker</span><span class="given-name">Dave</span></span></span><span class="org vcardline">Brandenburg InternetWorking</span><span class="adr"><span class="street-address vcardline">675 Spruce Dr.</span><span class="vcardline"><span class="locality">Sunnyvale</span>, <span class="region">CA</span>&nbsp;<span class="postal-code">94086</span></span><span class="country-name vcardline">US</span></span><span class="vcardline tel">Phone: <a href="tel:+1.408.246.8253"><span class="value">+1.408.246.8253</span></a></span><span class="vcardline">EMail: <a href="mailto:dcrocker@bbiw.net"><span class="email">dcrocker@bbiw.net</span></a></span></address>
758         <address class="vcard"><span class="vcardline"><span class="fn">Paul Overell</span><span class="n hidden"><span class="family-name">Overell</span><span class="given-name">Paul</span></span></span><span class="org vcardline">THUS plc.</span><span class="adr"><span class="street-address vcardline">1/2 Berkeley Square,</span><span class="street-address vcardline">99 Berkeley Street</span><span class="vcardline"><span class="locality">Glasgow</span>, <span class="postal-code">G3 7HR</span></span><span class="country-name vcardline">UK</span></span><span class="vcardline">EMail: <a href="mailto:paul.overell@thus.net"><span class="email">paul.overell@thus.net</span></a></span></address>
759      </div>
760      <h1 id="rfc.section.A" class="np"><a href="#rfc.section.A">A.</a>&nbsp;ACKNOWLEDGEMENTS
761      </h1>
762      <p id="rfc.section.A.p.1">The syntax for ABNF was originally specified in RFC 733. Ken L. Harrenstien, of SRI International, was responsible for re-coding
763         the BNF into an augmented BNF that makes the representation smaller and easier to understand.
764      </p>
765      <p id="rfc.section.A.p.2">This recent project began as a simple effort to cull out the portion of RFC 822 that has been repeatedly cited by non-email
766         specification writers, namely the description of augmented BNF. Rather than simply and blindly converting the existing text
767         into a separate document, the working group chose to give careful consideration to the deficiencies, as well as benefits,
768         of the existing specification and related specifications made available over the last 15 years, and therefore to pursue enhancement.
769         This turned the project into something rather more ambitious than was first intended. Interestingly, the result is not massively
770         different from that original, although decisions, such as removing the list notation, came as a surprise.
771      </p>
772      <p id="rfc.section.A.p.3">This "separated" version of the specification was part of the DRUMS working group, with significant contributions from Jerome
773         Abela, Harald Alvestrand, Robert Elz, Roger Fajman, Aviva Garrett, Tom Harsch, Dan Kohn, Bill McQuillan, Keith Moore, Chris
774         Newman, Pete Resnick, and Henning Schulzrinne.
775      </p>
776      <p id="rfc.section.A.p.4">Julian Reschke warrants a special thanks for converting the Draft Standard version to XML source form.</p>
777      <h1 id="rfc.section.B"><a href="#rfc.section.B">B.</a>&nbsp;<a id="CORE" href="#CORE">APPENDIX - CORE ABNF OF ABNF</a></h1>
778      <p id="rfc.section.B.p.1">This Appendix is provided as a convenient core for specific grammars. The definitions may be used as a core set of rules.</p>
779      <h2 id="rfc.section.B.1"><a href="#rfc.section.B.1">B.1.</a>&nbsp;Core Rules
780      </h2>
781      <p id="rfc.section.B.1.p.1">Certain basic rules are in uppercase, such as SP, HTAB, CRLF, DIGIT, ALPHA, etc.</p>
782      <div id="rfc.figure.u.27"></div> <pre class="inline">
783      ALPHA          =  %x41-5A / %x61-7A   ; A-Z / a-z
784
785      BIT            =  "0" / "1"
786
787      CHAR           =  %x01-7F
788                             ; any 7-bit US-ASCII character,
789                             ;  excluding NUL
790
791      CR             =  %x0D
792                             ; carriage return
793
794      CRLF           =  CR LF
795                             ; Internet standard newline
796
797      CTL            =  %x00-1F / %x7F
798                             ; controls
799
800      DIGIT          =  %x30-39
801                             ; 0-9
802
803      DQUOTE         =  %x22
804                             ; " (Double Quote)
805
806      HEXDIG         =  DIGIT / "A" / "B" / "C" / "D" / "E" / "F"
807
808      HTAB           =  %x09
809                             ; horizontal tab
810
811      LF             =  %x0A
812                             ; linefeed
813
814      LWSP           =  *(WSP / CRLF WSP)
815                             ; linear white space (past newline)
816
817      OCTET          =  %x00-FF
818                             ; 8 bits of data
819
820      SP             =  %x20
821
822      VCHAR          =  %x21-7E
823                             ; visible (printing) characters
824
825      WSP            =  SP / HTAB
826                             ; white space
827</pre> <h2 id="rfc.section.B.2"><a href="#rfc.section.B.2">B.2.</a>&nbsp;Common Encoding
828      </h2>
829      <p id="rfc.section.B.2.p.1">Externally, data are represented as "network virtual ASCII" (namely, 7-bit US-ASCII in an 8-bit field), with the high (8th)
830         bit set to zero. A string of values is in "network byte order", in which the higher-valued bytes are represented on the left-hand
831         side and are sent over the network first.
832      </p>
833      <h1><a id="rfc.copyright" href="#rfc.copyright">Full Copyright Statement</a></h1>
834      <p>Copyright © The Internet Society (2005).</p>
835      <p>This document is subject to the rights, licenses and restrictions contained in BCP 78, and except as set forth therein, the
836         authors retain all their rights.
837      </p>
838      <p>This document and the information contained herein are provided on an “AS IS” basis and THE CONTRIBUTOR, THE ORGANIZATION
839         HE/SHE REPRESENTS OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES,
840         EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY
841         RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
842      </p>
843      <h1><a id="rfc.ipr" href="#rfc.ipr">Intellectual Property</a></h1>
844      <p>The IETF takes no position regarding the validity or scope of any Intellectual Property Rights or other rights that might
845         be claimed to pertain to the implementation or use of the technology described in this document or the extent to which any
846         license under such rights might or might not be available; nor does it represent that it has made any independent effort to
847         identify any such rights. Information on the procedures with respect to rights in RFC documents can be found in BCP 78 and
848         BCP 79.
849      </p>
850      <p>Copies of IPR disclosures made to the IETF Secretariat and any assurances of licenses to be made available, or the result
851         of an attempt made to obtain a general license or permission for the use of such proprietary rights by implementers or users
852         of this specification can be obtained from the IETF on-line IPR repository at <a href="http://www.ietf.org/ipr">http://www.ietf.org/ipr</a>.
853      </p>
854      <p>The IETF invites any interested party to bring to its attention any copyrights, patents or patent applications, or other proprietary
855         rights that may cover technology that may be required to implement this standard. Please address the information to the IETF
856         at <a href="mailto:ietf-ipr@ietf.org">ietf-ipr@ietf.org</a>.
857      </p>
858      <h1>Acknowledgment</h1>
859      <p>Funding for the RFC Editor function is currently provided by the Internet Society.</p>
860   </body>
861</html>
Note: See TracBrowser for help on using the repository browser.