[Tools-discuss] Re: [art] Re: Exploring ABNF extracts from RFCs

Carsten Bormann <cabo@tzi.org> Fri, 26 July 2024 16:36 UTC

Return-Path: <cabo@tzi.org>
X-Original-To: tools-discuss@ietfa.amsl.com
Delivered-To: tools-discuss@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id D30A8C151095; Fri, 26 Jul 2024 09:36:59 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.906
X-Spam-Level:
X-Spam-Status: No, score=-1.906 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, URIBL_BLOCKED=0.001, URIBL_DBL_BLOCKED_OPENDNS=0.001, URIBL_ZEN_BLOCKED_OPENDNS=0.001] autolearn=ham autolearn_force=no
Received: from mail.ietf.org ([50.223.129.194]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jW_j_U-UqfuQ; Fri, 26 Jul 2024 09:36:57 -0700 (PDT)
Received: from smtp.zfn.uni-bremen.de (smtp.zfn.uni-bremen.de [IPv6:2001:638:708:32::21]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 6AFF1C14F738; Fri, 26 Jul 2024 09:36:54 -0700 (PDT)
Received: from smtpclient.apple (p5dc5d6c5.dip0.t-ipconnect.de [93.197.214.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.zfn.uni-bremen.de (Postfix) with ESMTPSA id 4WVtgk2gN1zDCcQ; Fri, 26 Jul 2024 18:36:50 +0200 (CEST)
Content-Type: text/plain; charset="utf-8"
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.600.62\))
From: Carsten Bormann <cabo@tzi.org>
In-Reply-To: <2867abac-8c62-41b2-a20c-cb9fe8d3736d@alum.mit.edu>
Date: Fri, 26 Jul 2024 18:36:39 +0200
Content-Transfer-Encoding: quoted-printable
Message-Id: <97E9D31B-567B-415B-AEFF-D2A561198571@tzi.org>
References: <89a4a566-8ffe-413e-9196-3f08bebe8d20@w3.org> <99E8B992-AF60-4CD6-9786-2EC180E95E4D@tzi.org> <2867abac-8c62-41b2-a20c-cb9fe8d3736d@alum.mit.edu>
To: Paul Kyzivat <pkyzivat@alum.mit.edu>
X-Mailer: Apple Mail (2.3774.600.62)
Message-ID-Hash: 6QK2Q47UBSJXEFXGSYPKVOVVITDFEJ4Q
X-Message-ID-Hash: 6QK2Q47UBSJXEFXGSYPKVOVVITDFEJ4Q
X-MailFrom: cabo@tzi.org
X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-tools-discuss.ietf.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header
CC: Dominique Hazael-Massieux <dom@w3.org>, art@ietf.org, tools-discuss <tools-discuss@ietf.org>, CBOR <cbor@ietf.org>, abnf-discuss@ietf.org
X-Mailman-Version: 3.3.9rc4
Precedence: list
Subject: [Tools-discuss] Re: [art] Re: Exploring ABNF extracts from RFCs
List-Id: IETF Tools Discussion <tools-discuss.ietf.org>
Archived-At: <https://mailarchive.ietf.org/arch/msg/tools-discuss/Hgkzal4FMOE7o_rdHoJlCnpRgo8>
List-Archive: <https://mailarchive.ietf.org/arch/browse/tools-discuss>
List-Help: <mailto:tools-discuss-request@ietf.org?subject=help>
List-Owner: <mailto:tools-discuss-owner@ietf.org>
List-Post: <mailto:tools-discuss@ietf.org>
List-Subscribe: <mailto:tools-discuss-join@ietf.org>
List-Unsubscribe: <mailto:tools-discuss-leave@ietf.org>

Hi Paul,

> There are interesting open issues around abnf dependencies:

Let me talk about the directions draft-ietf-cbor-cddl-modules <https://www.ietf.org/archive/id/draft-ietf-cbor-cddl-modules-02.html> [1] has taken on these.
Most of these decisions should transfer to ABNF right away.

[1]: https://www.ietf.org/archive/id/draft-ietf-cbor-cddl-modules-02.html

> * If I want to use a rule defined in another document, do I add to my abnf *all* of the foreign abnf that contains the rule definitions I need? Or do I only import the specific rules I need and any other rules those depend on?

Just the needed rules and dependencies.
(We do have an “import *”.)

> * What to do if the imported abnf has rule names that duplicate ones I have defined in my own abnf? Should the abnf of each document live in a distinct namespace, linked only for the cross referencing rule names? Or should the writer of abnf with dependencies be responsible for avoiding naming conflicts?

Namespacing can help. 
https://www.ietf.org/archive/id/draft-ietf-cbor-cddl-modules-02.html#name-namespacing

> * How to deal with the different ways abnf is used in documents. E.g.,
> 
> - the simple case: the document contains a single block of abnf defining the syntax for the protocol that is the subject of the document.

Easy.

> - the doc has several blocks of abnf, each defining a separate syntax. Rule names may be reused, with different syntax, in each.

The sourcecode block should have a name= attribute to help with this.
(Eventually, this should be checked by tools/the RFC editor.)

> - the doc contains (possibly incomplete) fragments of abnf scattered through the doc text, plus a complete consolidated abnf syntax that likely duplicates some or all of the fragments.

Again, a name= help; the consolidated grammar will be what you want to reference.

> - the doc contains a complete abnf syntax that is broken into fragments interspersed with text descriptions.

No problem, if the name= is equal for all the snippets, kramdown-rfc-extract-sourcecode assembles the fragments for you (in document order, but that doesn’t make a difference for ABNF).

> My interest in this came from working on sip for many years. It has a root document RFC3261, and many extension & revision documents. There are extensive dependencies among these documents. The manner of expressing dependencies evolved over time. E.g.,
> 
> - Simple text in the doc prior to the abnf. E.g.,: "The rules foo, bar, and baz are defined in RFCnnn".
> 
> - Saying (or simply assuming) that all the Core Rules from RFC5234 are available.
> 
> - Stating the dependency in comment in the abnf
> 
> - Stating the dependency in an abnf prose-val. E.g.,
>    foo = <foo as defined in RFCnnn>
> 
> The latter is now my recommended best practice. It results in an abnf that can be fully syntax checked. Ideally we would formalize the syntax within the prose-val so it can be mechanically processed. Or define a new syntax for import, and possibly for namespaces.

draft-ietf-cbor-cddl-modules [1] uses explicit import statements so the import relationships aren’t scattered over the rules.
(ABNF proseval syntax is an unmined asset that we do not have in CDDL.)

Grüße, Carsten