Subject: Re: [urn] ABNF

From: Peter Saint-Andre <[email-masked]>
Date: Mon, 26 Oct 2015 19:45:28 -0600

On 9/15/15 9:44 AM, John C Klensin wrote:
>
>
> --On Tuesday, September 15, 2015 09:11 -0600 Peter Saint-Andre -
> &yet <[email-masked]> wrote:
>
>> As mentioned last night, I have been experimenting with the
>> ABNF so that we can capture the fact that we don't want "??"
>> in a q-component, only at the start of an r-component.
>>
>> Unfortunately my experiments were not complete when I
>> submitted -13, so let's try to get this right in -14.
>>
>> I see two primary approaches:
>>
>> 1. Approximate things in the ABNF (as they were in -12) and
>> supplement the ABNF with some additional text (e.g., "a
>> q-component MUST NOT contain any sequences of two question
>> mark characters, since that sequence is to be used only at the
>> beginning of an r-component").
>>
>> 2. Try to capture things in the ABNF. Here is where I ended up
>> after publishing -13 last night (the only difference from -13
>> is that I changed the terms 'word' and 'phrase' to the less
>> suggestive terms 'ustring' and 'uset'):
>>
>>         namestring    = assigned-name
>>                         [ "?" q-component ]
>>                         [ "??" r-component ]
>>                         [ "#" f-component ]
>>         assigned-name = "urn" ":" NID ":" NSS
>>         NID           = (alphanum) 0*30(ldh) (alphanum)
>>         ldh           = alphanum / "-"
>>         NSS           = ustring
>>         q-component   = ustring *uset
>>         r-component   = ustring *uset
>>         ustring       = pchar *(pchar / "/")
>>         uset          = "?" ustring
>>         f-component   = fragment
>>
>> I am not an ABNF expert, so suggestions are welcome (including
>> the suggestion that #2 is impossible and I should give up).
>
> Peter,
>
> I don't think it is impossible.   I continue to prefer something
> resembling your first approach. #2 illustrates why:  It is
> really hard to look at that and efficiently deduce that the
> intent is to ban "??" except as the introducer for an
> r-component.  It is more likely to induce an "eyes glaze over"
> effect.   Because of that, if you were to use #2 (or a variation
> that works if #2 does not), I'd ask that we include a comment
> about that intent.  For better or worse, that comment is more or
> less equivalent to what you'd need for #1, so, especially
> because I believe no one would study the ABNF if the comment
> were there the main advantage of #2 over #1 would be to prove
> that you/we could do it.

Not a sufficient reason, IMHO. I suggest that we go back to the ABNF 
that we had in -12.

> Trying to sort out the syntax does nave one good feature in
> terms of forcing clarity of discussion.  It is not clear to me
> that we have discussed and decided whether
>      abcd?efgh
>      abcd??efgh
>      abcd?efgh??
>      abcdefgh?
>
> are valid r-components or not.   While I can't imagine anyone
> really caring about these sorts of cases in practice, pushing
> everything into ABNF forces us to decide, while a prose
> statement (as in #1) would allow us to say something like
> "question marks, especially consecutive ones, inside the
> r-component string or a question mark at the end of either an
> r-comonents or q-component, are bad ideas and likely to confuse
> people and computers alike, but not prohibited."

Some text along those lines seems helpful.

Peter