<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE rfc [
  <!ENTITY nbsp    "&#160;">
  <!ENTITY zwsp   "&#8203;">
  <!ENTITY nbhy   "&#8209;">
  <!ENTITY wj     "&#8288;">
]>
<?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?>
<!-- generated by https://github.com/cabo/kramdown-rfc version 1.7.5 (Ruby 3.2.2) -->
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" ipr="trust200902" docName="draft-ietf-cbor-update-8610-grammar-03" category="std" consensus="true" submissionType="IETF" updates="8610" tocInclude="true" sortRefs="true" symRefs="true" version="3">
  <!-- xml2rfc v2v3 conversion 3.19.0 -->
  <front>
    <title abbrev="CDDL grammar updates">Updates to the CDDL grammar of RFC 8610</title>
    <seriesInfo name="Internet-Draft" value="draft-ietf-cbor-update-8610-grammar-03"/>
    <author initials="C." surname="Bormann" fullname="Carsten Bormann">
      <organization>Universität Bremen TZI</organization>
      <address>
        <postal>
          <street>Postfach 330440</street>
          <city>Bremen</city>
          <code>D-28359</code>
          <country>Germany</country>
        </postal>
        <phone>+49-421-218-63921</phone>
        <email>cabo@tzi.org</email>
      </address>
    </author>
    <date year="2024" month="January" day="29"/>
    <area>ART</area>
    <workgroup>CBOR</workgroup>
    <keyword>Concise Data Definition Language</keyword>
    <abstract>
      <?line 80?>

<t>The Concise Data Definition Language (CDDL), as defined in
RFC 8610 and RFC 9165,
provides an easy and unambiguous way to express structures for
protocol messages and data formats that are represented in CBOR or
JSON.</t>
      <t>The present document updates RFC 8610 by addressing errata and making
other small fixes for the ABNF grammar defined for CDDL there.</t>
    </abstract>
    <note removeInRFC="true">
      <name>About This Document</name>
      <t>
        The latest revision of this draft can be found at <eref target="https://cbor-wg.github.io/update-8610-grammar/"/>.
        Status information for this document may be found at <eref target="https://datatracker.ietf.org/doc/draft-ietf-cbor-update-8610-grammar/"/>.
      </t>
      <t>
        Discussion of this document takes place on the
        CBOR Working Group mailing list (<eref target="mailto:cbor@ietf.org"/>),
        which is archived at <eref target="https://mailarchive.ietf.org/arch/browse/cbor/"/>.
        Subscribe at <eref target="https://www.ietf.org/mailman/listinfo/cbor/"/>.
      </t>
      <t>Source for this draft and an issue tracker can be found at
        <eref target="https://github.com/cbor-wg/update-8610-grammar"/>.</t>
    </note>
  </front>
  <middle>
    <?line 91?>

<section anchor="introduction">
      <name>Introduction</name>
      <t>The Concise Data Definition Language (CDDL), as defined in
<xref target="RFC8610"/> and <xref target="RFC9165"/>,
provides an easy and unambiguous way to express structures for
protocol messages and data formats that are represented in CBOR or
JSON.</t>
      <t>The present document updates <xref target="RFC8610"/> by addressing errata and making
other small fixes for the ABNF grammar defined for CDDL there.</t>
      <section anchor="conventions-and-definitions">
        <name>Conventions and Definitions</name>
        <t>The Terminology from <xref target="RFC8610"/> applies.
The grammar in <xref target="RFC8610"/> is based on ABNF, which is defined in <xref target="STD68"/>
and <xref target="RFC7405"/>.</t>
      </section>
    </section>
    <section anchor="clari">
      <name>Clarifications and Changes based on Errata Reports</name>
      <dl>
        <dt><em>Compatibility</em>:</dt>
        <dd>
          <t>errata fix</t>
        </dd>
      </dl>
      <t>A number of errata reports have been made around some details of text
string and byte string literal syntax: <xref target="Err6527"/> and <xref target="Err6543"/>.
These are being addressed in this section, updating details of the
ABNF for these literal syntaxes.
Also, <xref target="Err6526"/> needs to be applied (backslashes have been lost during
RFC processing in some text explaining backslash escaping).</t>
      <section anchor="e6527">
        <name>Err6527 (text string literals)</name>
        <t>The ABNF used in <xref target="RFC8610"/> for the content of text string literals
is rather permissive:</t>
        <figure anchor="e6527-old1">
          <name>Old ABNF for strings with permissive ABNF for SESC, but not allowing hex escapes</name>
          <sourcecode type="abnf"><![CDATA[
; RFC 8610 ABNF:
text = %x22 *SCHAR %x22
SCHAR = %x20-21 / %x23-5B / %x5D-7E / %x80-10FFFD / SESC
SESC = "\" (%x20-7E / %x80-10FFFD)
]]></sourcecode>
        </figure>
        <t>This allows almost any non-C0 character to be escaped by a backslash,
but critically misses out on the <tt>\uXXXX</tt> and <tt>\uHHHH\uLLLL</tt> forms
that JSON allows to specify characters in hex (which should be
applying here according to Bullet 6 of <xref section="3.1" sectionFormat="of" target="RFC8610"/>).
(Note that we import from JSON the unwieldy <tt>\uHHHH\uLLLL</tt> syntax,
which represents Unicode code points beyond U+FFFF by making them look
like UTF-16 surrogate pairs; CDDL text strings are not using UTF-16 or
surrogates.)</t>
        <t>Both can be solved by updating the SESC production.
We use the opportunity to add a popular form of directly specifying
characters in strings using hexadecimal escape sequences of the form
<tt>\u{hex}</tt>, where <tt>hex</tt> is the hexadecimal representation of the
Unicode scalar value.
The result is the new set of rules defining SESC in <xref target="e6527-new1"/>:</t>
        <figure anchor="e6527-new1">
          <name>Updated string ABNF to allow hex escapes</name>
          <sourcecode type="abnf" name="cddl-new-sesc.abnf"><![CDATA[
; new rules collectively defining SESC:
SESC = "\" ( %x22 / "/" / "\" /                 ; \" \/ \\
             %x62 / %x66 / %x6E / %x72 / %x74 / ; \b \f \n \r \t
             (%x75 hexchar) )                   ; \uXXXX
hexchar = "{" (1*"0" [ hexscalar ] / hexscalar) "}" /
          non-surrogate / (high-surrogate "\" %x75 low-surrogate)
non-surrogate = ((DIGIT / "A"/"B"/"C" / "E"/"F") 3HEXDIG) /
                ("D" %x30-37 2HEXDIG )
high-surrogate = "D" ("8"/"9"/"A"/"B") 2HEXDIG
low-surrogate = "D" ("C"/"D"/"E"/"F") 2HEXDIG
hexscalar = "10" 4HEXDIG / HEXDIG1 4HEXDIG
          / non-surrogate / 1*3HEXDIG
HEXDIG1 = DIGIT1 / "A" / "B" / "C" / "D" / "E" / "F"
]]></sourcecode>
        </figure>
        <t>(Notes:
In ABNF, strings such as <tt>"A"</tt>, <tt>"B"</tt> etc. are case-insensitive, as is
intended here.
We could have written <tt>%x62</tt> as <tt>%s"b"</tt>, but didn't, in order to
maximize ABNF tool compatibility.)</t>
        <t>Now that SESC is more restrictively formulated, this also requires an
update to the BCHAR production used in the ABNF syntax for byte string
literals:</t>
        <figure anchor="e6527-old2">
          <name>Old ABNF for BCHAR</name>
          <sourcecode type="abnf"><![CDATA[
; RFC 8610 ABNF:
bytes = [bsqual] %x27 *BCHAR %x27
BCHAR = %x20-26 / %x28-5B / %x5D-10FFFD / SESC / CRLF
bsqual = "h" / "b64"
]]></sourcecode>
        </figure>
        <t>With the SESC updated as above, <tt>\'</tt> is no longer allowed in BCHAR;
this now needs to be explicitly included.</t>
        <t>Updating BCHAR also provides an opportunity to address <xref target="Err6278"/>,
which points to an inconsistency in treating U+007F (DEL) between SCHAR and
BCHAR.
As U+007F is not printable, including it in a byte string literal is
as confusing as for a text string literal, and it should therefore be
excluded from BCHAR as it is from SCHAR.
The same reasoning also applies to the C1 control characters,
so we actually exclude the entire range from U+007F to U+009F.
The same reasoning then also applies to text in comments (PCHAR).
For completeness, all these should also explicitly exclude the code
points that have been set aside for UTF-16's surrogates.</t>
        <figure anchor="e6527-new2">
          <name>Updated ABNF for BCHAR, SCHAR, and PCHAR</name>
          <sourcecode type="abnf" name="cddl-new-bchar.abnf"><![CDATA[
; new rules for BCHAR and SCHAR:
SCHAR = %x20-21 / %x23-5B / %x5D-7E / NONASCII / SESC
BCHAR = %x20-26 / %x28-5B / %x5D-7E / NONASCII / SESC / "\'" / CRLF
PCHAR = %x20-7E / NONASCII
NONASCII = %xA0-D7FF / %xE000-10FFFD
]]></sourcecode>
        </figure>
        <t>(Note that, apart from addressing the inconsistencies, there is no
attempt to further exclude non-printable characters from the ABNF;
doing this properly would draw in complexity from the ongoing
evolution of the Unicode standard that is not needed here.)</t>
      </section>
      <section anchor="err6543-byte-string-literals">
        <name>Err6543 (byte string literals)</name>
        <t>The ABNF used in <xref target="RFC8610"/> for the content of byte string literals
lumps together byte strings notated as text with byte strings notated
in base16 (hex) or base64 (but see also updated BCHAR production above):</t>
        <figure anchor="e6527-old2a">
          <name>Old ABNF for BCHAR</name>
          <sourcecode type="abnf"><![CDATA[
; RFC 8610 ABNF:
bytes = [bsqual] %x27 *BCHAR %x27
BCHAR = %x20-26 / %x28-5B / %x5D-10FFFD / SESC / CRLF
]]></sourcecode>
        </figure>
        <section numbered="false" anchor="change-proposed-by-errata-report-6543">
          <name>Change proposed by Errata Report 6543</name>
          <t>Errata report 6543 proposes to handle the two cases in separate
productions (where, with an updated SESC, BCHAR obviously needs to be
updated as above):</t>
          <figure anchor="e6543-1">
            <name>Errata Report 8653 Proposal to Split the Byte String Rules</name>
            <sourcecode type="abnf"><![CDATA[
; Err6543 proposal:
bytes = %x27 *BCHAR %x27
      / bsqual %x27 *QCHAR %x27
BCHAR = %x20-26 / %x28-5B / %x5D-10FFFD / SESC / CRLF
QCHAR = DIGIT / ALPHA / "+" / "/" / "-" / "_" / "=" / WS
]]></sourcecode>
          </figure>
          <t>This potentially causes a subtle change, which is hidden in the WS production:</t>
          <figure anchor="e6543-2">
            <name>ABNF definition of WS from RFC 8610</name>
            <sourcecode type="abnf"><![CDATA[
; RFC 8610 ABNF:
WS = SP / NL
SP = %x20
NL = COMMENT / CRLF
COMMENT = ";" *PCHAR CRLF
PCHAR = %x20-7E / %x80-10FFFD
CRLF = %x0A / %x0D.0A
]]></sourcecode>
          </figure>
          <t>This allows any non-C0 character in a comment, so this fragment
becomes possible:</t>
          <sourcecode type="cddl"><![CDATA[
foo = h'
   43424F52 ; 'CBOR'
   0A       ; LF, but don't use CR!
'
]]></sourcecode>
          <t>The current text is not unambiguously saying whether the three apostrophes
need to be escaped with a <tt>\</tt> or not, as in:</t>
          <sourcecode type="cddl"><![CDATA[
foo = h'
   43424F52 ; \'CBOR\'
   0A       ; LF, but don\'t use CR!
'
]]></sourcecode>
          <t>... which would be supported by the existing ABNF in <xref target="RFC8610"/>.</t>
        </section>
        <section numbered="false" anchor="no-change-needed-after-addressing-e6527-section-e6527">
          <name>No change needed after addressing <xref format="title" target="e6527"/> (Section <xref format="counter" target="e6527"/>)</name>
          <t>This document takes the simpler approach of leaving the processing of
the content of the byte string literal to a semantic step after
processing the syntax of the <tt>bytes</tt>/<tt>BCHAR</tt> rules as updated by
<xref target="e6527-new1"/> and <xref target="e6527-new2"/>.</t>
          <t>The rules in <xref target="e6543-2"/> are therefore applied to the result of this
processing where <tt>bsqual</tt> is given as <tt>h</tt> or <tt>b64</tt>.</t>
          <t>Note that this approach also works well with the use of byte strings
in <xref section="3" sectionFormat="of" target="RFC9165"/>.
It does require some care when copy-pasting into CDDL models from ABNF
that contains single quotes (which may also hide as apostrophes
in comments); these need to be escaped or possibly replaced by <tt>%x27</tt>.</t>
          <t>Finally, our approach would lend support to extending <tt>bsqual</tt> in CDDL
similar to the way this is done for CBOR diagnostic notation in <xref target="I-D.ietf-cbor-edn-literals"/>.</t>
        </section>
      </section>
    </section>
    <section anchor="small-enabling-grammar-changes">
      <name>Small Enabling Grammar Changes</name>
      <t>The two subsections in this section specify two small changes to the
grammar that are intended to enable certain kinds of specifications.</t>
      <section anchor="empty">
        <name>Empty data models</name>
        <dl spacing="compact">
          <dt><em>Compatibility</em>:</dt>
          <dd>
            <t>backward (not forward)</t>
          </dd>
        </dl>
        <t><xref target="RFC8610"/> requires a CDDL file to have at least one rule.</t>
        <figure anchor="empty-old">
          <name>Old ABNF for top-level rule cddl</name>
          <sourcecode type="abnf"><![CDATA[
; RFC 8610 ABNF:
cddl = S 1*(rule S)
]]></sourcecode>
        </figure>
        <t>This makes sense when the file has to stand alone, as a CDDL data
model needs to have at least one rule to provide an entry point (start
rule).</t>
        <t>With CDDL modules <xref target="I-D.ietf-cbor-cddl-modules"/>, CDDL files can also include directives,
and these might be the source of all the rules that
ultimately make up the module created by the file.
Any other rule content in the file has to be available for directive
processing, making the requirement for at least one rule cumbersome.</t>
        <t>Therefore, we extend the grammar as in <xref target="empty-new"/>
and make the existence of at least one rule a semantic constraint, to
be fulfilled after processing of all directives.</t>
        <figure anchor="empty-new">
          <name>Updated ABNF for top-level rule cddl</name>
          <sourcecode type="abnf" name="cddl-new-cddl.abnf"><![CDATA[
; new top-level rule:
cddl = S *(rule S)
]]></sourcecode>
        </figure>
      </section>
      <section anchor="tagnum">
        <name>Non-literal Tag Numbers</name>
        <dl spacing="compact">
          <dt><em>Compatibility</em>:</dt>
          <dd>
            <t>backward (not forward)</t>
          </dd>
        </dl>
        <t>The existing ABNF syntax for expressing tags in CDDL is:</t>
        <figure anchor="tag-old">
          <name>Old ABNF for tag syntax</name>
          <sourcecode type="abnf"><![CDATA[
; extracted from RFC 8610 ABNF:
type2 =/ "#" "6" ["." uint] "(" S type S ")"
]]></sourcecode>
        </figure>
        <t>This means tag numbers can only be given as literal numbers (uints).
Some specifications operate on ranges of tag numbers, e.g., <xref target="RFC9277"/>
has a range of tag numbers 1668546817 (0x63740101) to 1668612095
(0x6374FFFF) to tag specific content formats.
This can currently not be expressed in CDDL.</t>
        <t>This update extends this to:</t>
        <figure anchor="tag-new">
          <name>Updated ABNF for tag syntax</name>
          <sourcecode type="abnf" name="cddl-new-tag.abnf"><![CDATA[
; new rules collectively defining the tagged case:
type2 =/ "#" "6" ["." tag-number] "(" S type S ")"
tag-number = uint / ("<" type ">")
]]></sourcecode>
        </figure>
        <t>So the above range can be expressed in a CDDL fragment such as:</t>
        <sourcecode type="cddl"><![CDATA[
ct-tag<content> = #6.<ct-tag-number>(content)
ct-tag-number = 1668546817..1668612095
; or use 0x63740101..0x6374FFFF
]]></sourcecode>
        <t>Notes:</t>
        <ol spacing="normal" type="1"><li>
            <t>This syntax reuses the angle bracket syntax for generics;
this reuse is innocuous as a generic parameter/argument only ever
occurs after a rule name (<tt>id</tt>), while it occurs after <tt>.</tt> here.
(Whether there is potential for human confusion can be debated; the
above example deliberately uses generics as well.)</t>
          </li>
          <li>
            <t>The updated ABNF grammar makes it a bit more explicit that the
number given after the optional dot is special, not giving the CBOR
"additional information" as it is with other uses of <tt>#</tt> in CDDL.
(Adding this observation to <xref section="2.2.3" sectionFormat="of" target="RFC8610"/> is the subject
of <xref target="Err6575"/>; it is correctly noted in <xref section="3.6" sectionFormat="of" target="RFC8610"/>.)
In hindsight, maybe a different character than the dot should have
been chosen for this special case, however changing the grammar
now would have been too disruptive.</t>
          </li>
        </ol>
      </section>
    </section>
    <section anchor="security-considerations">
      <name>Security Considerations</name>
      <t>The grammar fixes and updates in this document are not believed to
create additional security considerations.
The security considerations in <xref section="5" sectionFormat="of" target="RFC8610"/> do apply, and
specifically the potential for confusion is increased in an
environment that uses a combination of CDDL tools some of which have
been updated and some of which have not been, in particular based on
<xref target="clari"/>.</t>
    </section>
    <section anchor="iana-considerations">
      <name>IANA Considerations</name>
      <t>This document has no IANA actions.</t>
    </section>
  </middle>
  <back>
    <references>
      <name>References</name>
      <references anchor="sec-normative-references">
        <name>Normative References</name>
        <reference anchor="RFC8610">
          <front>
            <title>Concise Data Definition Language (CDDL): A Notational Convention to Express Concise Binary Object Representation (CBOR) and JSON Data Structures</title>
            <author fullname="H. Birkholz" initials="H." surname="Birkholz"/>
            <author fullname="C. Vigano" initials="C." surname="Vigano"/>
            <author fullname="C. Bormann" initials="C." surname="Bormann"/>
            <date month="June" year="2019"/>
            <abstract>
              <t>This document proposes a notational convention to express Concise Binary Object Representation (CBOR) data structures (RFC 7049). Its main goal is to provide an easy and unambiguous way to express structures for protocol messages and data formats that use CBOR or JSON.</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="8610"/>
          <seriesInfo name="DOI" value="10.17487/RFC8610"/>
        </reference>
        <referencegroup anchor="STD68" target="https://www.rfc-editor.org/info/std68">
          <reference anchor="RFC5234" target="https://www.rfc-editor.org/info/rfc5234">
            <front>
              <title>Augmented BNF for Syntax Specifications: ABNF</title>
              <author fullname="D. Crocker" initials="D." role="editor" surname="Crocker"/>
              <author fullname="P. Overell" initials="P." surname="Overell"/>
              <date month="January" year="2008"/>
              <abstract>
                <t>Internet technical specifications often need to define a formal syntax. Over the years, a modified version of Backus-Naur Form (BNF), called Augmented BNF (ABNF), has been popular among many Internet specifications. The current specification documents ABNF. It balances compactness and simplicity with reasonable representational power. The differences between standard BNF and ABNF involve naming rules, repetition, alternatives, order-independence, and value ranges. This specification also supplies additional rule definitions and encoding for a core lexical analyzer of the type common to several Internet specifications. [STANDARDS-TRACK]</t>
              </abstract>
            </front>
            <seriesInfo name="STD" value="68"/>
            <seriesInfo name="RFC" value="5234"/>
            <seriesInfo name="DOI" value="10.17487/RFC5234"/>
          </reference>
        </referencegroup>
      </references>
      <references anchor="sec-informative-references">
        <name>Informative References</name>
        <reference anchor="RFC7405">
          <front>
            <title>Case-Sensitive String Support in ABNF</title>
            <author fullname="P. Kyzivat" initials="P." surname="Kyzivat"/>
            <date month="December" year="2014"/>
            <abstract>
              <t>This document extends the base definition of ABNF (Augmented Backus-Naur Form) to include a way to specify US-ASCII string literals that are matched in a case-sensitive manner.</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="7405"/>
          <seriesInfo name="DOI" value="10.17487/RFC7405"/>
        </reference>
        <reference anchor="RFC9165">
          <front>
            <title>Additional Control Operators for the Concise Data Definition Language (CDDL)</title>
            <author fullname="C. Bormann" initials="C." surname="Bormann"/>
            <date month="December" year="2021"/>
            <abstract>
              <t>The Concise Data Definition Language (CDDL), standardized in RFC 8610, provides "control operators" as its main language extension point.</t>
              <t>The present document defines a number of control operators that were not yet ready at the time RFC 8610 was completed:,, and for the construction of constants; / for including ABNF (RFC 5234 and RFC 7405) in CDDL specifications; and for indicating the use of a non-basic feature in an instance.</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="9165"/>
          <seriesInfo name="DOI" value="10.17487/RFC9165"/>
        </reference>
        <reference anchor="I-D.ietf-cbor-cddl-modules">
          <front>
            <title>CDDL Module Structure</title>
            <author fullname="Carsten Bormann" initials="C." surname="Bormann">
              <organization>Universität Bremen TZI</organization>
            </author>
            <date day="18" month="December" year="2023"/>
            <abstract>
              <t>   At the time of writing, the Concise Data Definition Language (CDDL)
   is defined by RFC 8610 and RFC 9165.  The latter has used the
   extension point provided in RFC 8610, the _control operator_.

   As CDDL is being used in larger projects, the need for corrections
   and additional features has become known that cannot be easily mapped
   into this single extension point.  Hence, there is a need for
   evolution of the base CDDL specification itself.

   The present document defines a backward- and forward-compatible way
   to add a module structure to CDDL.

              </t>
            </abstract>
          </front>
          <seriesInfo name="Internet-Draft" value="draft-ietf-cbor-cddl-modules-01"/>
        </reference>
        <reference anchor="I-D.ietf-cbor-edn-literals">
          <front>
            <title>CBOR Extended Diagnostic Notation (EDN): Application-Oriented Literals, ABNF, and Media Type</title>
            <author fullname="Carsten Bormann" initials="C." surname="Bormann">
              <organization>Universität Bremen TZI</organization>
            </author>
            <date day="21" month="December" year="2023"/>
            <abstract>
              <t>   The Concise Binary Object Representation, CBOR (STD 94, RFC 8949),
   defines a "diagnostic notation" in order to be able to converse about
   CBOR data items without having to resort to binary data.

   This document specifies how to add application-oriented extensions to
   the diagnostic notation.  It then defines two such extensions for
   text representations of epoch-based date/times and of IP addresses
   and prefixes (RFC 9164).

   A few further additions close some gaps in usability.  To facilitate
   tool interoperation, this document specifies a formal ABNF definition
   for extended diagnostic notation (EDN) that accommodates application-
   oriented literals.

              </t>
            </abstract>
          </front>
          <seriesInfo name="Internet-Draft" value="draft-ietf-cbor-edn-literals-07"/>
        </reference>
        <reference anchor="Err6278" target="https://www.rfc-editor.org/errata/eid6278">
          <front>
            <title>Errata Report 6278</title>
            <author>
              <organization/>
            </author>
            <date/>
          </front>
          <seriesInfo name="RFC" value="8610"/>
        </reference>
        <reference anchor="Err6526" target="https://www.rfc-editor.org/errata/eid6526">
          <front>
            <title>Errata Report 6526</title>
            <author>
              <organization/>
            </author>
            <date/>
          </front>
          <seriesInfo name="RFC" value="8610"/>
        </reference>
        <reference anchor="Err6527" target="https://www.rfc-editor.org/errata/eid6527">
          <front>
            <title>Errata Report 6527</title>
            <author>
              <organization/>
            </author>
            <date/>
          </front>
          <seriesInfo name="RFC" value="8610"/>
        </reference>
        <reference anchor="Err6543" target="https://www.rfc-editor.org/errata/eid6543">
          <front>
            <title>Errata Report 6543</title>
            <author>
              <organization/>
            </author>
            <date/>
          </front>
          <seriesInfo name="RFC" value="8610"/>
        </reference>
        <reference anchor="Err6575" target="https://www.rfc-editor.org/errata/eid6575">
          <front>
            <title>Errata Report 6575</title>
            <author>
              <organization/>
            </author>
            <date/>
          </front>
          <seriesInfo name="RFC" value="8610"/>
        </reference>
        <reference anchor="RFC9277">
          <front>
            <title>On Stable Storage for Items in Concise Binary Object Representation (CBOR)</title>
            <author fullname="M. Richardson" initials="M." surname="Richardson"/>
            <author fullname="C. Bormann" initials="C." surname="Bormann"/>
            <date month="August" year="2022"/>
            <abstract>
              <t>This document defines a stored ("file") format for Concise Binary Object Representation (CBOR) data items that is friendly to common systems that recognize file types, such as the Unix file(1) command.</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="9277"/>
          <seriesInfo name="DOI" value="10.17487/RFC9277"/>
        </reference>
      </references>
    </references>
    <?line 421?>

<section anchor="updated-collected-abnf-for-cddl">
      <name>Updated Collected ABNF for CDDL</name>
      <t>This appendix provides the full ABNF from <xref target="RFC8610"/> with the updates
applied in the present document.</t>
      <figure anchor="collected-abnf">
        <name>ABNF for CDDL as updated</name>
        <sourcecode type="abnf" name="cddl-updated-complete.abnf"><![CDATA[
cddl = S *(rule S)
rule = typename [genericparm] S assignt S type
     / groupname [genericparm] S assigng S grpent

typename = id
groupname = id

assignt = "=" / "/="
assigng = "=" / "//="

genericparm = "<" S id S *("," S id S ) ">"
genericarg = "<" S type1 S *("," S type1 S ) ">"

type = type1 *(S "/" S type1)

type1 = type2 [S (rangeop / ctlop) S type2]
; space may be needed before the operator if type2 ends in a name

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 ">")

rangeop = "..." / ".."

ctlop = "." id

group = grpchoice *(S "//" S grpchoice)

grpchoice = *(grpent optcom)

grpent = [occur S] [memberkey S] type
       / [occur S] groupname [genericarg]  ; preempted by above
       / [occur S] "(" S group S ")"

memberkey = type1 S ["^" S] "=>"
          / bareword S ":"
          / value S ":"

bareword = id

optcom = S ["," S]

occur = [uint] "*" [uint]
      / "+"
      / "?"

uint = DIGIT1 *DIGIT
     / "0x" 1*HEXDIG
     / "0b" 1*BINDIG
     / "0"

value = number
      / text
      / bytes

int = ["-"] uint

; This is a float if it has fraction or exponent; int otherwise
number = hexfloat / (int ["." fraction] ["e" exponent ])
hexfloat = ["-"] "0x" 1*HEXDIG ["." 1*HEXDIG] "p" exponent
fraction = 1*DIGIT
exponent = ["+"/"-"] 1*DIGIT

text = %x22 *SCHAR %x22
SCHAR = %x20-21 / %x23-5B / %x5D-7E / NONASCII / SESC

SESC = "\" ( %x22 / "/" / "\" /                 ; \" \/ \\
             %x62 / %x66 / %x6E / %x72 / %x74 / ; \b \f \n \r \t
             (%x75 hexchar) )                   ; \uXXXX

hexchar = "{" (1*"0" [ hexscalar ] / hexscalar) "}" /
          non-surrogate / (high-surrogate "\" %x75 low-surrogate)
non-surrogate = ((DIGIT / "A"/"B"/"C" / "E"/"F") 3HEXDIG) /
                ("D" %x30-37 2HEXDIG )
high-surrogate = "D" ("8"/"9"/"A"/"B") 2HEXDIG
low-surrogate = "D" ("C"/"D"/"E"/"F") 2HEXDIG
hexscalar = "10" 4HEXDIG / HEXDIG1 4HEXDIG
          / non-surrogate / 1*3HEXDIG

bytes = [bsqual] %x27 *BCHAR %x27
BCHAR = %x20-26 / %x28-5B / %x5D-7E / NONASCII / SESC / "\'" / CRLF
bsqual = "h" / "b64"

id = EALPHA *(*("-" / ".") (EALPHA / DIGIT))
ALPHA = %x41-5A / %x61-7A
EALPHA = ALPHA / "@" / "_" / "$"
DIGIT = %x30-39
DIGIT1 = %x31-39
HEXDIG = DIGIT / "A" / "B" / "C" / "D" / "E" / "F"
HEXDIG1 = DIGIT1 / "A" / "B" / "C" / "D" / "E" / "F"
BINDIG = %x30-31

S = *WS
WS = SP / NL
SP = %x20
NL = COMMENT / CRLF
COMMENT = ";" *PCHAR CRLF
PCHAR = %x20-7E / NONASCII
NONASCII = %xA0-D7FF / %xE000-10FFFD
CRLF = %x0A / %x0D.0A
]]></sourcecode>
      </figure>
    </section>
    <section numbered="false" anchor="acknowledgments">
      <name>Acknowledgments</name>
      <t>TODO acknowledge.</t>
      <t>Many thanks go to the submitters of the errata reports addressed in
this document.
In one of the ensuing discussions, Doug Ewell proposed to define an
ABNF rule NONASCII, of which we have included the essence.</t>
    </section>
  </back>
  <!-- ##markdown-source:
H4sIAAAAAAAAA+1b63IbR3b+30/RGcUrQAZAglcJMr3m1eaWLGlFqbQVUQkG
Mw1gloMZeC4EsSr6WfIjT5K8WL5zTvfMgIRoW85WslVhFUnM9O30uX7ndKPb
7arrgd5WqoiK2Ay0924e+oXJdZHqYmr08cnJCz3J/NnMz3Q61m/OjvXTvf6m
p/zRKDMY6610KWW4p1SYBok/w5Rh5o+LbmSKcTcYpVlXunRplq4d1o1pUKHy
IjP+bKDPT9+eKTvVgNdTjzQ9DVTgFwOdF6EK0iQ3SV6iQ5GVRvkYOtCHb96q
RZpdTbK0nA/08dGrN+rKLPEqHCjd1cdpEkS50Sd+4esTM46SqIjSRL/wk0np
T4y6NkmJZbRuzqD1zI/igSb6v6Od9NJsQn2iYlqOwAPe2GKysWZvHvrJ9gZ6
WhTzfLCxYbv3ZHwvStcN3FDKL4tpmhE1XfxqLQw99rO8MIk+SrOZnyTcAnoG
+l0SXZssj4r/+o9CH2Vmhk5v/+WcOxBrDUh4nebF2A+ment7c2dnk9uCqFgO
7AB5kYZY56S79XR795l9UyZFhl7fG1p0yS/n0zRBv693nnV3tvrdrf7T7t72
s60+NxrLMn+Uflf8LWKOKZUQzQXIpE1BmWjD6BSGMZ4v3p7sPR1of5SMlYqS
8Z2++zubu9LaDfzcyMtn/T28hDIUWRrTyufdk16tbDRzd5aGZUyaZD/c62XC
pBtHhcn8GL3wBHV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