<?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.4 (Ruby 3.2.2) -->
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" ipr="trust200902" docName="draft-ietf-cbor-update-8610-grammar-02" category="std" consensus="true" submissionType="IETF" updates="8610" tocInclude="true" sortRefs="true" symRefs="true" version="3">
  <!-- xml2rfc v2v3 conversion 3.18.2 -->
  <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-02"/>
    <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="2023" month="December" day="15"/>
    <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 to:</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 = 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
]]></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><cref anchor="headingbug">note that the HTML rendering of the heading is
butchered by xml2rfc, as noted in
https://github.com/ietf-tools/xml2rfc/issues/683; we except
this to have been fixed before this document is published</cref></t>
          <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">
          <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="17" month="June" 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.


   // Previous versions of the changes in this document were part of
   // draft-bormann-cbor-cddl-2-draft and previously draft-bormann-cbor-
   // cddl-freezer.  This submission extracts out the functionality that
   // is ready for further WG work.

              </t>
            </abstract>
          </front>
          <seriesInfo name="Internet-Draft" value="draft-ietf-cbor-cddl-modules-00"/>
        </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="20" month="November" 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).

   To facilitate tool interoperation, this document also 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-06"/>
        </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 419?>

<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 = 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

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"
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+1b63LbyJX+30/RC29i0kNSInU1PZqMrhmlPPbEkmtSazkr
EGiSiECAwUUU49I8y/7YJ9l9sf3OOd0AKNHKjGdTW6laVUki0LfT5/KdSze7
3a66HeotpYqoiM1Qe+/noV+YXBepLqZGH5+cvNaTzJ/N/EynY/3u7Fjv7/Y3
PeWPRpnBWG+lSynDPaXCNEj8GaYMM39cdCNTjLvBKM260qVLs3TtsG5MgwqV
F5nxZ0N9fnp5puxUQ15PPdP0NFSBXwx1XoQqSJPcJHmJDkVWGuVj6FAfvrtU
izS7mWRpOR/q46O379SNWeJVOFS6q4/TJIhyo0/8wtcnZhwlURGliX7tJ5PS
nxh1a5ISy2jdnEHrmR/FQ030f0s76aXZhPpExbQcgQe8scVkY83ePPST7Q31
tCjm+XBjw3bvyfhelK4buKGUXxbTNCNquvjVWhh67Gd5YRJ9lGYzP0m4BfQM
9fskujVZHhX//Z+FPsrMDJ0u/+2cOxBrDUj4Ic2LsR9M9dbW5vb2JrcFUbEc
2gHyIg2xzkl3sL+189K+KZMiQ6/fG1p0yS/n0zRBv6+2X3a3B/3uoL/f3d16
Oehzo7Es80fpt8XfIuaYUgnRXIBM2hSUiTaMTmEY4/ni8mR3f6j9UTJWKkrG
D/rubW/uSGs38HMjL1/2d/ESylBkaUwrn3dPerWy0czdWRqWMWmS/fColwmT
bhwVJvNj9MIT1G39RJnp2rVotvqJBpS5GZfxkD5qXfjZxDREbkUdpDMn/Q2a
cmMR3UQb73lklyzJjhZrlPdshKD5NMt2B3v7Q9Wc33MLLBaLXjYOsJeoSDNi
94bJMqj5holCGuepxsyn3KTfmXmaFZqaRUtMFpmcWC+rMIutBdIT26Aeg03G
ErQz2P0igjDuKYLQ/MUE7X0hQXtPE7T3pQRtb30ZQdtbTxK0vfWlBO3tfBlB
eztPErS384sJUqr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