2

Here are the examples:

     Transfer-Encoding       = "Transfer-Encoding" ":" 1#transfer-coding
     Upgrade        = "Upgrade" ":" 1#product
     Server         = "Server" ":" 1*( product | comment )
     delta-seconds  = 1*DIGIT
     Via =  "Via" ":" 1#( received-protocol received-by [ comment ] )
     chunk-extension= *( ";" chunk-ext-name [ "=" chunk-ext-val ] )
     http_URL = "http:" "//" host [ ":" port ] [ abs_path [ "?" query ]]
     date3        = month SP ( 2DIGIT | ( SP 1DIGIT ))

Questions are:

  1. What is the 1#transfer-coding (the 1# regarding the rule transfer-coding)? Same with 1#product.
  2. What does 1 times x mean, as in 1*( product | comment )? Or 1*DIGIT.
  3. What do the brackets mean, as in [ comment ]? The parens (...) group it all, but what about the [...]?
  4. What does the *(...) mean, as in *( ";" chunk-ext-name [ "=" chunk-ext-val ] )?
  5. What do the nested square brackets mean, as in [ abs_path [ "?" query ]]? Nested optional values? It doesn't make sense.
  6. What does 2DIGIT and 1DIGIT mean, where do those come from / get defined?

I may have missed where these are defined, but knowing these would help clarify how to parse the grammar definitions they use in the RFCs.

I get the rest of the grammar notation, juts not these few remaining pieces.

Update: Looks like this is a good start.

Square brackets enclose an optional element sequence:

    [foo bar]

is equivalent to

    *1(foo bar).

Specific Repetition: nRule

A rule of the form:

    <n>element

is equivalent to

    <n>*<n>element

That is, exactly <n> occurrences of <element>. Thus, 2DIGIT is a 2-digit number, and 3ALPHA is a string of three alphabetic characters.

Variable Repetition: *Rule

The operator "*" preceding an element indicates repetition. The full form is:

    <a>*<b>element

where <a> and <b> are optional decimal values, indicating at least <a> and at most <b> occurrences of the element.

Default values are 0 and infinity so that *<element> allows any number, including zero; 1*<element> requires at least one; 3*3<element> allows exactly 3; and 1*2<element> allows one or two.

But what I'm still missing is what the # means?

Update 2: Found it I think!

#RULE: LISTS

      A construct "#" is defined, similar to "*", as follows:

                          <l>#<m>element

 indicating at least <l> and at most <m> elements, each  separated
 by  one  or more commas (","). This makes the usual form of lists
 very easy; a rule such as '(element *("," element))' can be shown
 as  "1#element". 

Also, what do these mean?

  • 1*2DIGIT
  • 2*4DIGIT
Lance
  • 75,200
  • 93
  • 289
  • 503

0 Answers0