source: draft-ietf-httpbis/orig/rfc5234.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: 41.5 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 5234"; 
269  } 
270  @top-right {
271       content: "January 2008"; 
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 Core ABNF of ABNF" href="#rfc.section.B">
309      <link rel="Alternate" title="Authorative ASCII Version" href="http://www.ietf.org/rfc/rfc5234.txt">
310      <link rel="Help" title="Additional Information on tools.ietf.org" href="http://tools.ietf.org/html/rfc5234">
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:5234">
317      <meta name="dct.issued" scheme="ISO8601" content="2008-01">
318      <meta name="dct.replaces" content="urn:ietf:rfc:4234">
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: 5234</td>
332               <td class="right">Brandenburg InternetWorking</td>
333            </tr>
334            <tr>
335               <td class="left">Obsoletes: <a href="http://tools.ietf.org/html/rfc4234">4234</a></td>
336               <td class="right">P. Overell</td>
337            </tr>
338            <tr>
339               <td class="left">STD: 68</td>
340               <td class="right">THUS plc.</td>
341            </tr>
342            <tr>
343               <td class="left">Category: Standards Track</td>
344               <td class="right">January 2008</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 id="rfc.abstract"><a href="#rfc.abstract">Abstract</a></h1> 
355      <p>Internet technical specifications often need to define a formal syntax. Over the years, a modified version of Backus-Naur
356         Form (BNF), called Augmented BNF (ABNF), has been popular among many Internet specifications. The current specification documents
357         ABNF. It balances compactness and simplicity with reasonable representational power. The differences between standard BNF
358         and ABNF involve naming rules, repetition, alternatives, order- independence, and value ranges. This specification also supplies
359         additional rule definitions and encoding for a core lexical analyzer of the type common to several Internet specifications.
360      </p> 
361      <hr class="noprint">
362      <h1 class="np" id="rfc.toc"><a href="#rfc.toc">Table of Contents</a></h1>
363      <ul class="toc">
364         <li class="tocline0">1.&nbsp;&nbsp;&nbsp;<a href="#rfc.section.1">Introduction</a></li>
365         <li class="tocline0">2.&nbsp;&nbsp;&nbsp;<a href="#rfc.section.2">Rule Definition</a><ul class="toc">
366               <li class="tocline1">2.1&nbsp;&nbsp;&nbsp;<a href="#rfc.section.2.1">Rule Naming</a></li>
367               <li class="tocline1">2.2&nbsp;&nbsp;&nbsp;<a href="#rfc.section.2.2">Rule Form</a></li>
368               <li class="tocline1">2.3&nbsp;&nbsp;&nbsp;<a href="#rfc.section.2.3">Terminal Values</a></li>
369               <li class="tocline1">2.4&nbsp;&nbsp;&nbsp;<a href="#rfc.section.2.4">External Encodings</a></li>
370            </ul>
371         </li>
372         <li class="tocline0">3.&nbsp;&nbsp;&nbsp;<a href="#rfc.section.3">Operators</a><ul class="toc">
373               <li class="tocline1">3.1&nbsp;&nbsp;&nbsp;<a href="#rfc.section.3.1">Concatenation:  Rule1 Rule2</a></li>
374               <li class="tocline1">3.2&nbsp;&nbsp;&nbsp;<a href="#Alternatives">Alternatives:  Rule1 / Rule2</a></li>
375               <li class="tocline1">3.3&nbsp;&nbsp;&nbsp;<a href="#Incremental">Incremental Alternatives: Rule1 =/ Rule2</a></li>
376               <li class="tocline1">3.4&nbsp;&nbsp;&nbsp;<a href="#Range">Value Range Alternatives:  %c##-##</a></li>
377               <li class="tocline1">3.5&nbsp;&nbsp;&nbsp;<a href="#Sequence">Sequence Group:  (Rule1 Rule2)</a></li>
378               <li class="tocline1">3.6&nbsp;&nbsp;&nbsp;<a href="#VarRep">Variable Repetition:  *Rule</a></li>
379               <li class="tocline1">3.7&nbsp;&nbsp;&nbsp;<a href="#SpecRep">Specific Repetition:  nRule</a></li>
380               <li class="tocline1">3.8&nbsp;&nbsp;&nbsp;<a href="#OptSeq">Optional Sequence:  [RULE]</a></li>
381               <li class="tocline1">3.9&nbsp;&nbsp;&nbsp;<a href="#Comment">Comment:  ; Comment</a></li>
382               <li class="tocline1">3.10&nbsp;&nbsp;&nbsp;<a href="#rfc.section.3.10">Operator Precedence</a></li>
383            </ul>
384         </li>
385         <li class="tocline0">4.&nbsp;&nbsp;&nbsp;<a href="#rfc.section.4">ABNF Definition of ABNF</a></li>
386         <li class="tocline0">5.&nbsp;&nbsp;&nbsp;<a href="#rfc.section.5">Security Considerations</a></li>
387         <li class="tocline0">6.&nbsp;&nbsp;&nbsp;<a href="#rfc.references">References</a><ul class="toc">
388               <li class="tocline1">6.1&nbsp;&nbsp;&nbsp;<a href="#rfc.references.1">Normative References</a></li>
389               <li class="tocline1">6.2&nbsp;&nbsp;&nbsp;<a href="#rfc.references.2">Informative References</a></li>
390            </ul>
391         </li>
392         <li class="tocline0"><a href="#rfc.authors">Authors' Addresses</a></li>
393         <li class="tocline0">A.&nbsp;&nbsp;&nbsp;<a href="#rfc.section.A">Acknowledgements</a></li>
394         <li class="tocline0">B.&nbsp;&nbsp;&nbsp;<a href="#CORE">Core ABNF of ABNF</a><ul class="toc">
395               <li class="tocline1">B.1&nbsp;&nbsp;&nbsp;<a href="#rfc.section.B.1">Core Rules</a></li>
396               <li class="tocline1">B.2&nbsp;&nbsp;&nbsp;<a href="#rfc.section.B.2">Common Encoding</a></li>
397            </ul>
398         </li>
399         <li class="tocline0"><a href="#rfc.ipr">Intellectual Property and Copyright Statements</a></li>
400      </ul>
401      <h1 id="rfc.section.1" class="np"><a href="#rfc.section.1">1.</a>&nbsp;Introduction
402      </h1>
403      <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
404         deem useful. Over the years, a modified version of Backus-Naur Form (BNF), called Augmented BNF (ABNF), has been popular among
405         many Internet specifications. It balances compactness and simplicity with reasonable representational power. In the early
406         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
407         reference. Predictably, it also provides some modifications and enhancements.
408      </p>
409      <p id="rfc.section.1.p.2">The differences between standard BNF and ABNF involve naming rules, repetition, alternatives, order-independence, and value
410         ranges. <a href="#CORE" title="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.
411         It is provided as a convenience and is otherwise separate from the meta language defined in the body of this document, and
412         separate from its formal status.
413      </p>
414      <h1 id="rfc.section.2"><a href="#rfc.section.2">2.</a>&nbsp;Rule Definition
415      </h1>
416      <h2 id="rfc.section.2.1"><a href="#rfc.section.2.1">2.1</a>&nbsp;Rule Naming
417      </h2>
418      <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
419         followed by a combination of alphabetics, digits, and hyphens (dashes).
420      </p>
421      <p id="rfc.section.2.1.p.2"> </p>
422      <dl>
423         <dt>NOTE:  </dt>
424         <dd>Rule names are case insensitive.</dd>
425      </dl>
426      <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>
427      <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
428         their presence facilitates in discerning the use of a rule name. This is typically restricted to rule name references in free-form
429         prose, or to distinguish partial rules that combine into a string not separated by white space, such as shown in the discussion
430         about repetition, below.
431      </p>
432      <h2 id="rfc.section.2.2"><a href="#rfc.section.2.2">2.2</a>&nbsp;Rule Form
433      </h2>
434      <p id="rfc.section.2.2.p.1">A rule is defined by the following sequence:</p>
435      <div id="rfc.figure.u.1"></div> <pre>
436      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
437         indicator (carriage return followed by line feed). The equal sign separates the name from the definition of the rule. The
438         elements form a sequence of one or more rule names and/or value definitions, combined according to the various operators defined
439         in this document, such as alternative and repetition.
440      </p>
441      <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.
442         The left alignment and indentation are relative to the first lines of the ABNF rules and need not match the left margin of
443         the document.
444      </p>
445      <h2 id="rfc.section.2.3"><a href="#rfc.section.2.3">2.3</a>&nbsp;Terminal Values
446      </h2>
447      <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
448         integer. In certain contexts, a specific mapping (encoding) of values into a character set (such as ASCII) will be specified.
449      </p>
450      <div id="rfc.figure.u.2"></div> 
451      <p>Terminals are specified by one or more numeric characters, with the base interpretation of those characters indicated explicitly.
452         The following bases are currently defined:
453      </p>  <pre>
454      b           =  binary
455
456      d           =  decimal
457
458      x           =  hexadecimal </pre> <div id="rfc.figure.u.3"></div> 
459      <p>Hence:</p>  <pre>
460      CR          =  %d13
461
462      CR          =  %x0D
463</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.
464      </p> 
465      <div id="rfc.figure.u.4"></div> 
466      <p>A concatenated string of such values is specified compactly, using a period (".") to indicate a separation of characters within
467         that value. Hence:
468      </p>  <pre>
469      CRLF        =  %d13.10 </pre> <div id="rfc.figure.u.5"></div> 
470      <p>ABNF permits the specification of literal text strings directly, enclosed in quotation marks. Hence:</p>  <pre>
471      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>
472      <p id="rfc.section.2.3.p.7"> </p>
473      <dl>
474         <dt>NOTE:  </dt>
475         <dd>ABNF strings are case insensitive and the character set for these strings is US-ASCII.</dd>
476      </dl>
477      <div id="rfc.figure.u.6"></div> 
478      <p>Hence:</p>  <pre>
479      rulename = "abc" </pre> <div id="rfc.figure.u.7"></div> 
480      <p>and:</p>  <pre>
481      rulename = "aBc"
482</pre>  <p>will match "abc", "Abc", "aBc", "abC", "ABc", "aBC", "AbC", and "ABC".</p> 
483      <p id="rfc.section.2.3.p.10"> </p>
484      <ul class="empty">
485         <li>To specify a rule that is case sensitive, specify the characters individually.</li>
486      </ul>
487      <div id="rfc.figure.u.8"></div> 
488      <p>For example:</p>  <pre>
489      rulename    =  %d97 %d98 %d99
490</pre> <div id="rfc.figure.u.9"></div> 
491      <p>or</p>  <pre>
492      rulename    =  %d97.98.99
493</pre>  <p>will match only the string that comprises only the lowercase characters, abc.</p> 
494      <h2 id="rfc.section.2.4"><a href="#rfc.section.2.4">2.4</a>&nbsp;External Encodings
495      </h2>
496      <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.
497         Hence, the same ABNF-based grammar may have multiple external encodings, such as one for a 7-bit US-ASCII environment, another
498         for a binary octet environment, and still a different one when 16-bit Unicode is used. Encoding details are beyond the scope
499         of ABNF, although <a href="#CORE" title="Core ABNF of ABNF">Appendix&nbsp;B</a> provides definitions for a 7-bit US-ASCII environment as has been common to much of the Internet.
500      </p>
501      <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
502         syntax.
503      </p>
504      <h1 id="rfc.section.3"><a href="#rfc.section.3">3.</a>&nbsp;Operators
505      </h1>
506      <h2 id="rfc.section.3.1"><a href="#rfc.section.3.1">3.1</a>&nbsp;Concatenation:  Rule1 Rule2
507      </h2>
508      <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
509         of rule names. For example:
510      </p>
511      <div id="rfc.figure.u.10"></div> <pre>
512      foo         =  %x61           ; a
513
514      bar         =  %x62           ; b
515
516      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>
517      <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
518         parsed according to the rules defined in ABNF. For Internet specifications, there is some history of permitting linear white
519         space (space and horizontal tab) to be freely and implicitly interspersed around major constructs, such as delimiting special
520         characters or atomic strings.
521      </p>
522      <p id="rfc.section.3.1.p.5">NOTE: </p>
523      <ul class="empty">
524         <li>This specification for ABNF does not provide for implicit specification of linear white space.</li>
525      </ul>
526      <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
527         often useful to provide for such white space in "core" rules that are then used variously among higher-level rules. The "core"
528         rules might be formed into a lexical analyzer or simply be part of the main ruleset.
529      </p>
530      <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>
531      <p id="rfc.section.3.2.p.1">Elements separated by a forward slash ("/") are alternatives. Therefore,</p>
532      <div id="rfc.figure.u.11"></div> <pre>
533      foo / bar 
534</pre>  <p>will accept &lt;foo&gt; or &lt;bar&gt;.</p> 
535      <p id="rfc.section.3.2.p.3"> </p>
536      <dl>
537         <dt>NOTE:  </dt>
538         <dd>A quoted string containing alphabetic characters is a special form for specifying alternative characters and is interpreted
539            as a non-terminal representing the set of combinatorial strings with the contained characters, in the specified order but
540            with any mixture of upper- and lowercase.
541         </dd>
542      </dl>
543      <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>
544      <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
545         alternatives, with later rule definitions adding to the set of alternatives. This is particularly useful for otherwise independent
546         specifications that derive from the same parent ruleset, such as often occurs with parameter lists. ABNF permits this incremental
547         definition through the construct:
548      </p>
549      <div id="rfc.figure.u.12"></div> <pre>
550      oldrule     =/ additional-alternatives </pre> <div id="rfc.figure.u.13"></div> 
551      <p>So that the ruleset</p>  <pre>
552      ruleset     =  alt1 / alt2
553
554      ruleset     =/ alt3
555
556      ruleset     =/ alt4 / alt5 </pre> <div id="rfc.figure.u.14"></div> 
557      <p>is the same as specifying</p>  <pre>
558      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>
559      <div id="rfc.figure.u.15"></div> 
560      <p>A range of alternative numeric values can be specified compactly, using a dash ("-") to indicate the range of alternative
561         values. Hence:
562      </p>  <pre>
563      DIGIT       =  %x30-39 </pre> <div id="rfc.figure.u.16"></div> 
564      <p>is equivalent to:</p>  <pre>
565      DIGIT       =  "0" / "1" / "2" / "3" / "4" / "5" / "6" /
566
567                     "7" / "8" / "9" </pre> <div id="rfc.figure.u.17"></div> 
568      <p>Concatenated numeric values and numeric value ranges cannot be specified in the same string. A numeric value may use the dotted
569         notation for concatenation or it may use the dash notation to specify one value range. Hence, to specify one printable character
570         between end-of-line sequences, the specification could be:
571      </p>  <pre>
572      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>
573      <div id="rfc.figure.u.18"></div> 
574      <p>Elements enclosed in parentheses are treated as a single element, whose contents are strictly ordered. Thus,</p>  <pre>
575      elem (foo / bar) blat
576</pre>  <p>matches (elem foo blat) or (elem bar blat), and</p> 
577      <div id="rfc.figure.u.19"></div> <pre>
578      elem foo / bar blat
579</pre>  <p>matches (elem foo) or (bar blat).</p> 
580      <p id="rfc.section.3.5.p.3"> </p>
581      <dl>
582         <dt>NOTE:  </dt>
583         <dd>It is strongly advised that grouping notation be used, rather than relying on the proper reading of "bare" alternations, when
584            alternatives consist of multiple rule names or literals.
585         </dd>
586      </dl>
587      <div id="rfc.figure.u.20"></div> 
588      <p>Hence, it is recommended that the following form be used:</p>  <pre>
589     (elem foo) / (bar blat)
590</pre>  <p>It will avoid misinterpretation by casual readers.</p> 
591      <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>
592      <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>
593      <div id="rfc.figure.u.21"></div> 
594      <p>The operator "*" preceding an element indicates repetition. The full form is:</p>  <pre>
595      &lt;a&gt;*&lt;b&gt;element
596</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> 
597      <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;
598         3*3&lt;element&gt; allows exactly 3; and 1*2&lt;element&gt; allows one or two.
599      </p>
600      <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>
601      <div id="rfc.figure.u.22"></div> 
602      <p>A rule of the form:</p>  <pre>
603      &lt;n&gt;element </pre> <div id="rfc.figure.u.23"></div> 
604      <p>is equivalent to</p>  <pre>
605      &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
606         characters.
607      </p>
608      <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>
609      <div id="rfc.figure.u.24"></div> 
610      <p>Square brackets enclose an optional element sequence:</p>  <pre>
611      [foo bar] </pre> <div id="rfc.figure.u.25"></div> 
612      <p>is equivalent to</p>  <pre>
613      *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>
614      <p id="rfc.section.3.9.p.1">A semicolon starts a comment that continues to the end of line. This is a simple way of including useful notes in parallel
615         with the specifications.
616      </p>
617      <h2 id="rfc.section.3.10"><a href="#rfc.section.3.10">3.10</a>&nbsp;Operator Precedence
618      </h2>
619      <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
620         (loosest) at the bottom:
621      </p>
622      <ul class="empty">
623         <li>Rule name, prose-val, Terminal value</li>
624         <li>Comment</li>
625         <li>Value range</li>
626         <li>Repetition</li>
627         <li>Grouping, Optional</li>
628         <li>Concatenation</li>
629         <li>Alternative</li>
630      </ul>
631      <p id="rfc.section.3.10.p.2">Use of the alternative operator, freely mixed with concatenations, can be confusing.</p>
632      <p id="rfc.section.3.10.p.3"> </p>
633      <ul class="empty">
634         <li>Again, it is recommended that the grouping operator be used to make explicit concatenation groups.</li>
635      </ul>
636      <h1 id="rfc.section.4"><a href="#rfc.section.4">4.</a>&nbsp;ABNF Definition of ABNF
637      </h1>
638      <p id="rfc.section.4.p.1"> </p>
639      <dl>
640         <dt>NOTES:</dt>
641         <dd> 
642            <ol>
643               <li>This syntax requires a formatting of rules that is relatively strict. Hence, the version of a ruleset included in a specification
644                  might need preprocessing to ensure that it can be interpreted by an ABNF parser.
645               </li>
646               <li>This syntax uses the rules provided in <a href="#CORE" title="Core ABNF of ABNF">Appendix&nbsp;B</a>.
647               </li>
648            </ol> 
649         </dd>
650      </dl>
651      <div id="rfc.figure.u.26"></div> <pre class="inline">
652      rulelist       =  1*( rule / (*c-wsp c-nl) )
653
654      rule           =  rulename defined-as elements c-nl
655                             ; continues if next line starts
656                             ;  with white space
657
658      rulename       =  ALPHA *(ALPHA / DIGIT / "-")
659
660      defined-as     =  *c-wsp ("=" / "=/") *c-wsp
661                             ; basic rules definition and
662                             ;  incremental alternatives
663
664      elements       =  alternation *c-wsp
665
666      c-wsp          =  WSP / (c-nl WSP)
667
668      c-nl           =  comment / CRLF
669                             ; comment or newline
670
671      comment        =  ";" *(WSP / VCHAR) CRLF
672
673      alternation    =  concatenation
674                        *(*c-wsp "/" *c-wsp concatenation)
675
676      concatenation  =  repetition *(1*c-wsp repetition)
677
678      repetition     =  [repeat] element
679
680      repeat         =  1*DIGIT / (*DIGIT "*" *DIGIT)
681
682      element        =  rulename / group / option /
683                        char-val / num-val / prose-val
684
685      group          =  "(" *c-wsp alternation *c-wsp ")"
686
687      option         =  "[" *c-wsp alternation *c-wsp "]"
688
689      char-val       =  DQUOTE *(%x20-21 / %x23-7E) DQUOTE
690                             ; quoted string of SP and VCHAR
691                             ;  without DQUOTE
692
693      num-val        =  "%" (bin-val / dec-val / hex-val)
694
695      bin-val        =  "b" 1*BIT
696                        [ 1*("." 1*BIT) / ("-" 1*BIT) ]
697                             ; series of concatenated bit values
698                             ;  or single ONEOF range
699
700      dec-val        =  "d" 1*DIGIT
701                        [ 1*("." 1*DIGIT) / ("-" 1*DIGIT) ]
702
703      hex-val        =  "x" 1*HEXDIG
704                        [ 1*("." 1*HEXDIG) / ("-" 1*HEXDIG) ]
705
706
707
708
709      prose-val      =  "&lt;" *(%x20-3D / %x3F-7E) "&gt;"
710                             ; bracketed string of SP and VCHAR
711                             ;  without angles
712                             ; prose description, to be used as
713                             ;  last resort </pre> <h1 id="rfc.section.5"><a href="#rfc.section.5">5.</a>&nbsp;Security Considerations
714      </h1>
715      <p id="rfc.section.5.p.1">Security is truly believed to be irrelevant to this document.</p>
716      <h1 id="rfc.references"><a id="rfc.section.6" href="#rfc.section.6">6.</a> References
717      </h1>
718      <h2 id="rfc.references.1"><a href="#rfc.section.6.1" id="rfc.section.6.1">6.1</a> Normative References
719      </h2>
720      <table> 
721         <tr>
722            <td class="reference"><b id="US-ASCII">[US-ASCII]</b></td>
723            <td class="top">American National Standards
724               Institute, “Coded Character Set -- 7-bit American Standard Code for Information Interchange”, ANSI&nbsp;X3.4, 1986.
725            </td>
726         </tr>
727      </table>
728      <h2 id="rfc.references.2"><a href="#rfc.section.6.2" id="rfc.section.6.2">6.2</a> Informative References
729      </h2>
730      <table>   
731         <tr>
732            <td class="reference"><b id="RFC733">[RFC733]</b></td>
733            <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.
734            </td>
735         </tr>
736         <tr>
737            <td class="reference"><b id="RFC822">[RFC822]</b></td>
738            <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.
739            </td>
740         </tr>
741      </table>
742      <div class="avoidbreak">
743         <h1 id="rfc.authors"><a href="#rfc.authors">Authors' Addresses</a></h1>
744         <address class="vcard"><span class="vcardline"><span class="fn">Dave Crocker</span>
745               (editor)
746               <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>
747         <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>
748      </div>
749      <h1 id="rfc.section.A" class="np"><a href="#rfc.section.A">A.</a>&nbsp;Acknowledgements
750      </h1>
751      <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
752         the BNF into an Augmented BNF that makes the representation smaller and easier to understand.
753      </p>
754      <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
755         specification writers, namely the description of Augmented BNF. Rather than simply and blindly converting the existing text
756         into a separate document, the working group chose to give careful consideration to the deficiencies, as well as benefits,
757         of the existing specification and related specifications made available over the last 15 years, and therefore to pursue enhancement.
758         This turned the project into something rather more ambitious than was first intended. Interestingly, the result is not massively
759         different from that original, although decisions, such as removing the list notation, came as a surprise.
760      </p>
761      <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
762         Abela, Harald Alvestrand, Robert Elz, Roger Fajman, Aviva Garrett, Tom Harsch, Dan Kohn, Bill McQuillan, Keith Moore, Chris
763         Newman, Pete Resnick, and Henning Schulzrinne.
764      </p>
765      <p id="rfc.section.A.p.4">Julian Reschke warrants a special thanks for converting the Draft Standard version to XML source form.</p>
766      <h1 id="rfc.section.B"><a href="#rfc.section.B">B.</a>&nbsp;<a id="CORE" href="#CORE">Core ABNF of ABNF</a></h1>
767      <p id="rfc.section.B.p.1">This appendix contains some basic rules that are in common use. Basic rules are in uppercase. Note that these rules are only
768         valid for ABNF encoded in 7-bit ASCII or in characters sets that are a superset of 7-bit ASCII.
769      </p>
770      <h2 id="rfc.section.B.1"><a href="#rfc.section.B.1">B.1</a>&nbsp;Core Rules
771      </h2>
772      <p id="rfc.section.B.1.p.1">Certain basic rules are in uppercase, such as SP, HTAB, CRLF, DIGIT, ALPHA, etc.</p>
773      <div id="rfc.figure.u.27"></div> <pre class="inline">
774      ALPHA          =  %x41-5A / %x61-7A   ; A-Z / a-z
775
776      BIT            =  "0" / "1"
777
778      CHAR           =  %x01-7F
779                             ; any 7-bit US-ASCII character,
780                             ;  excluding NUL
781
782      CR             =  %x0D
783                             ; carriage return
784
785      CRLF           =  CR LF
786                             ; Internet standard newline
787
788      CTL            =  %x00-1F / %x7F
789                             ; controls
790
791      DIGIT          =  %x30-39
792                             ; 0-9
793
794      DQUOTE         =  %x22
795                             ; " (Double Quote)
796
797      HEXDIG         =  DIGIT / "A" / "B" / "C" / "D" / "E" / "F"
798
799      HTAB           =  %x09
800                             ; horizontal tab
801
802      LF             =  %x0A
803                             ; linefeed
804
805      LWSP           =  *(WSP / CRLF WSP)
806                             ; Use of this linear-white-space rule
807                             ;  permits lines containing only white
808                             ;  space that are no longer legal in
809                             ;  mail headers and have caused
810                             ;  interoperability problems in other
811                             ;  contexts.
812                             ; Do not use when defining mail
813                             ;  headers and use with caution in
814                             ;  other contexts.
815
816      OCTET          =  %x00-FF
817                             ; 8 bits of data
818
819      SP             =  %x20
820
821      VCHAR          =  %x21-7E
822                             ; visible (printing) characters
823
824      WSP            =  SP / HTAB
825                             ; white space </pre> <h2 id="rfc.section.B.2"><a href="#rfc.section.B.2">B.2</a>&nbsp;Common Encoding
826      </h2>
827      <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)
828         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
829         side and are sent over the network first.
830      </p>
831      <h1><a id="rfc.copyright" href="#rfc.copyright">Full Copyright Statement</a></h1>
832      <p>Copyright © The IETF Trust (2008).</p>
833      <p>This document is subject to the rights, licenses and restrictions contained in BCP 78, and except as set forth therein, the
834         authors retain all their rights.
835      </p>
836      <p>This document and the information contained herein are provided on an “AS IS” basis and THE CONTRIBUTOR, THE ORGANIZATION
837         HE/SHE REPRESENTS OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY, THE IETF TRUST AND THE INTERNET ENGINEERING TASK FORCE
838         DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN
839         WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
840      </p>
841      <h1><a id="rfc.ipr" href="#rfc.ipr">Intellectual Property</a></h1>
842      <p>The IETF takes no position regarding the validity or scope of any Intellectual Property Rights or other rights that might
843         be claimed to pertain to the implementation or use of the technology described in this document or the extent to which any
844         license under such rights might or might not be available; nor does it represent that it has made any independent effort to
845         identify any such rights. Information on the procedures with respect to rights in RFC documents can be found in BCP 78 and
846         BCP 79.
847      </p>
848      <p>Copies of IPR disclosures made to the IETF Secretariat and any assurances of licenses to be made available, or the result
849         of an attempt made to obtain a general license or permission for the use of such proprietary rights by implementers or users
850         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>.
851      </p>
852      <p>The IETF invites any interested party to bring to its attention any copyrights, patents or patent applications, or other proprietary
853         rights that may cover technology that may be required to implement this standard. Please address the information to the IETF
854         at <a href="mailto:ietf-ipr@ietf.org">ietf-ipr@ietf.org</a>.
855      </p>
856   </body>
857</html>
Note: See TracBrowser for help on using the repository browser.