Closed chrysn closed 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).
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.
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.
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.
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.)
To me, #4 is good enough to close this.
(as for don't have ... if only we could just import from another document ;-) )
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
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.