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

Last change on this file since 599 was 598, checked in by julian.reschke@…, 14 years ago

fix Makefile, add RFC 2817/2818, re-gen HTML

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