Subject: Re: [Cbor] ABNF in place of regex (Was: Re: CDDL: Solving the regexp issue)

From: Sean Leonard <[email-masked]>
Date: Tue, 17 Jul 2018 15:00:35 -0400

I was going through the mailing list and saw this proposal. I think it is a reasonable proposal. I do not think it replaces the need for .regexp but it is a good illustration of a proposed control operator that has utility (i.e., as an alternative, not an alternate, to .regexp).

Your proposal would be better if it is simply:

".abnf" S elements CRLF

where elements is the rule defined in RFC 5234.

The broader point here relates to how to add control operators to CDDL. I think this illustrates a point that the value following the control operator needs to be specified in relation to the control operator ID. It does not make sense to say
  type1 .ge "foo"
as that would be a syntax error; only 
  type1 .ge 6.3
(i.e., numbers) are valid.

Sean

> On Mar 30, 2018, at 8:09 AM, Pete Cordell <[email-masked]> wrote:
> 
> Thinking laterally, if specifying a regex format is problematic, is it worth considering ABNF as an alternative?
> 
> The pipe character could act as a suitable delimiter.  For example:
> 
>   triple-digit = tstr .abnf | 1*DIGIT "." 1*DIGIT "." 1*DIGIT |
> 
> Over multiple lines it could look like:
> 
>   triple-digit = tstr .abnf |
>        1*DIGIT "." 1*DIGIT "." 1*DIGIT
>   |
> 
> The ABNF could be loosely defined; as in:
> 
>   opague-abnf = *( text / NOT-PIPE )
>   NOT-PIPE = CRLF / %x20-5B / %x7D-10FFFD
> 
> It's more verbose. And it's unconventional.  But...
> 
> Pete.
> -- 
> ---------------------------------------------------------------------
> Pete Cordell
> http://json-content-rules.org Rule
> ---------------------------------------------------------------------
> 
> _______________________________________________
> CBOR mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/cbor

---

From: Carsten Bormann <[email-masked]>
Date: Tue, 17 Jul 2018 16:54:52 -0400

Hi Pete,

Mixing in ABNF into CDDL is still something I’d like to do (for 2.0).

A simple control like the .abnf you used in March is not enough, since most ABNF right hand sides require one or more rules to become useful.  In this case, DIGIT (even if that happens to be a core rule — you still have to provide it).  A good place to keep those additional rules hasn’t occurred to me.

Also, it would be nice for this to have an equivalent of Python’s “”” for this — you used | (which would be quite confusing for people that think in classic BNF).

Ugly straw man: maybe something like

triple-digit = text .abnf “”” 1*DIGIT 2*(“.” 1*DIGIT)
                      DIGIT = %x30-39
“””

(i.e., the first line of the string is used as the RHS for an anonymous ABNF rule, the others provide additional rules.)

Grüße, Carsten

> On Mar 30, 2018, at 08:09, Pete Cordell <[email-masked]> wrote:
>

---

From: Sean Leonard <[email-masked]>
Date: Tue, 17 Jul 2018 18:31:42 -0400

A solution to the ABNF referencing problem is discussed in Section 3 of draft-seantek-more-core-rules-08 <https://tools.ietf.org/html/draft-seantek-abnf-more-core-rules-08>. For example:

emailAddress = text .abnf addr-spec@[RFC5322]

:)

(A similar kind of reference notation could be developed for CDDL itself, but I am not proposing such a thing at this time.)

Regards,

Sean

> On Jul 17, 2018, at 4:54 PM, Carsten Bormann <[email-masked]> wrote:
> 
> Hi Pete,
>

---

From: Carsten Bormann <[email-masked]>
Date: Tue, 17 Jul 2018 18:55:45 -0400

An external referencing system (preferably using URIs) would be a useful component of the module system that has been bandied about for CDDL 2.0.  Not sure that extracting an ABNF (or CDDL) rule by name from an RFC is always well-defined, but it will be in most useful applications of this.

Grüße, Carsten

> On Jul 17, 2018, at 18:31, Sean Leonard <[email-masked]> wrote:
>

---

From: Sean Leonard <[email-masked]>
Date: Wed, 18 Jul 2018 00:23:14 -0400

Okay.

By the way, the draft also specifies <> syntax, as in: addr-spec@<https://www.ietf.org/rfc/rfc5322.txt> for URIs and file paths (in ABNF). <> syntax is not particularly useful in RFC documents, but could/is supposed to be much more useful in flat files.

Regards, Sean

> On Jul 17, 2018, at 6:55 PM, Carsten Bormann <[email-masked]> wrote:
>