cbor-wg / update-8610-grammar

Update errata and other small fixes for the ABNF grammar defined for CDDL in RFC 8610
Other
0 stars 0 forks source link

ABNF: CDDLism #3

Closed chrysn closed 10 months ago

chrysn commented 10 months ago

While the summarized ABNF is OK (if one adds a final newline), the snippet in 3.2 does not validate even with the proper surroundings.

It says

type2 /= "#" "6" ["." tag-number] "(" S type S ")"

which uses a CDDL-style later alternative, whereas ABNF's incremental alternatives are =/.

Neither validates in https://author-tools.ietf.org/abnf, but that's probably OK because those are rarely used.

cabo commented 10 months ago

Right, these snippets are extracted from the long

type2 = value
      / typename [genericarg]
      / "(" S type S ")"
      / "{" S group S "}"
      / "[" S group S "]"
      / "~" S typename [genericarg]
      / "&" S "(" S group S ")"
      / "&" S groupname [genericarg]
      / "#" "6" ["." tag-number] "(" S type S ")"
      / "#" DIGIT ["." uint]                ; major/ai
      / "#"                                 ; any
tag-number = uint / ("<" type ">")

So the question would be how best to phrase these extracts (certainly not with broken ABNF).

chrysn commented 10 months ago

The =/ mechanism in ABNF's incremental alternatives does seem suitable. It's apparently a niche thing in ABNF (as evidenced by lack of support in the tool), but it's sufficient to create a small example that is valid ABNF.

cabo commented 10 months ago

The ABNF tool does support =/, but it requires type2 to already be defined (which is not needed in CDDL, by the way). So the snippet would not validate stand-alone.

chrysn commented 10 months ago

Does it need to? It's common in documents to incrementally build ABNF, and to what I would assume to be Knuth's discontent, we do not have formal language that expresses order or dependencies. This snippet will need to be appended to the original RFC8610 ABNF to be valid.

cabo commented 10 months ago

Well, these are snippets, not code that actually integrates with the existing ABNF.

(We do have a syntax for building models from snippets based on name=, but that is not used here, as we don't have the other snippets.)

chrysn commented 10 months ago

To me, #4 is good enough to close this.

(as for don't have ... if only we could just import from another document ;-) )