Internet DRAFT - draft-kyzivat-abnf-import
draft-kyzivat-abnf-import
Network Working Group P. Kyzivat
Internet-Draft Huawei
Updates: 5234 (if approved) January 3, 2013
Intended status: Standards Track
Expires: July 7, 2013
ABNF Extensions for Importing and Scoping
draft-kyzivat-abnf-import-00
Abstract
This document proposes extensions to the ABNF defined in [RFC5234] to
support importation of ABNF from other documents, and multiple naming
scopes for rulenames.
Status of this Memo
This Internet-Draft is submitted in full conformance with the
provisions of BCP 78 and BCP 79.
Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF). Note that other groups may also distribute
working documents as Internet-Drafts. The list of current Internet-
Drafts is at http://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress."
This Internet-Draft will expire on July 7, 2013.
Copyright Notice
Copyright (c) 2013 IETF Trust and the persons identified as the
document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents
(http://trustee.ietf.org/license-info) in effect on the date of
publication of this document. Please review these documents
carefully, as they describe your rights and restrictions with respect
to this document. Code Components extracted from this document must
include Simplified BSD License text as described in Section 4.e of
the Trust Legal Provisions and are provided without warranty as
described in the Simplified BSD License.
Kyzivat Expires July 7, 2013 [Page 1]
Internet-Draft ABNF Import January 2013
1. Introduction
The intent of this proposal is to better support current practice
where one draft or RFC extends the ABNF from another draft or RFC, or
references ABNF rules defined elsewhere when defining something new.
Currently that is done using comments that identify the source of the
referenced definitions. Formally processing this requires manual
actions to cut and paste definitions from multiple documents to
create a single ABNF source that can be processed for formal tools.
With the proposed changes, it will be possible to build ABNF tools
that automatically extract the required definitions.
The changes that support this are:
o A way to assign a name to a rule list within a document
This allows multiple independent groups of rules to be defined
within a single document and referenced independently. For
flexibility, nesting of named rule lists is permitted.
o A way to reference a rule defined in a named collection of rules
o A way to import rule definitions from another document
The reference identifies the document and may name a specific
named rule list within that document. When importing a named rule
list, it may be imported with or without the name. The
definitions are copied into
2. Terminology
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
document are to be interpreted as described in [RFC2119].
3. Extensions to ABNF Syntax
The following are additions to the ABNF for ABNF defined in
[RFC5234].
Kyzivat Expires July 7, 2013 [Page 2]
Internet-Draft ABNF Import January 2013
rulelist =/ 1*(
named-rulelist / rulelist-import / rule/ (*c-wsp c-nl) )
; this is really a backward compatible replacement definition
named-rulelist =
rulelist-name *WSP "{" rulelist "}" c-nl
rulelist-name = rulename
rulelist-import =
(basic-import / named-import) c-nl
basic-import = "@" docname
; imports all the ABNF from the named document
docname = char-val
; format and resolution of the document from the docname
; is defined by the specific tools used.
; At least common URI types should be supported
; E.g. "urn:ietf:rfc:5234",
; "urn:ietf:id:draft-ietf-foo-bar-01",
; "file:foo.xml"
named-import = rulelist-name basic-import
; (E.g. CORE@"urn:ietf:rfc:5234")
; This is shorthand for importing into a new named
; rulelist with the given name.
element =/ scoped-rulename
scoped-rulename = 1*(rulelist-name ".") rulename
4. Import Semantics
Importing logically replaces the import statement with text from the
imported document. Importing may be done in two ways:
o The <basic-import> simply inserts all the ABNF from the referenced
document.
o The <named-import> is similar, but does the import within a new
<named-rulelist>. This is just syntactic sugar, but is
convenient. E.g. the following:
CORE@"urn:ietf:rfc:5234"
Kyzivat Expires July 7, 2013 [Page 3]
Internet-Draft ABNF Import January 2013
is equivalent to:
CORE {
@"urn:ietf:rfc:5234"
}
Note that if the imported rules contain references to rules that are
not imported, then the importing document must provide definitions
for those.
For now, the ABNF syntax of ABNF defines a docname as a string
without further syntax. Interpretation of the docname is deferred to
the ABNF processing tools. I propose that this should at least
support common URI formats, including the urn:ietf format for rfcs
and ids. It may also be expedient to support some more concise
syntax for ietf documents.
The intent is that the import statements only import the ABNF
definitions from the referenced document, ignoring any content that
is not ABNF. This is so that ABNF from RFCs and drafts can be
referenced directly. The xml2rfc notation <artwork type='abnf'>
should be sufficient to support this. If multiple abnf artwork
elements are present they should simply be concatenated to form one
logical document to be imported.
5. Scoping of Names
A document containing ABNF has an implicit outermost scope. Each
scope has a symbol table for rules and named rulelists defined within
that scope.
The appearance of a <named-rulelist> with a particular <rulelist-
name> creates a nested scope with that name within the enclosing
scope's symbol table. Once a named rulelist has been closed it may
not be reopened. (This ensures that redefinition of a named rulelist
is an error, preventing a class of errors.)
An element consisting of a <rulename> is resolved within the symbol
table of the scope where it is found. If not found, resolution is
attempted successively in each enclosing scope.
An element consisting of a <scoped-rulename> is resolved as follows:
o The leftmost component of the <scoped-rulename> (the first
<rulelist-name>) is resolved first.
Kyzivat Expires July 7, 2013 [Page 4]
Internet-Draft ABNF Import January 2013
o It is resolved by looking within the symbol table of the scope
where it is found. If not found, resolution is attempted
successively in each enclosing scope, and must resolve to a
<named-rulelist>.
o Then the next component (<rulelist-name> or <rulename>) is
resolved within the symbol table of that rulelist. This continues
until the last component has been resolved.
I'm undecided whether it should be possible to have both a rule and a
rulelist with the same name in the same scope.
It is important to maintain the order independence of rule
definitions that exists with prior definitions of ABNF. (It must be
possible to reference a rule in a named rulelist that is defined
later.)
6. IANA Considerations
Don't think so.
7. Security Considerations
Security is truly believed to be irrelevant to this document.
8. References
8.1. Normative References
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", BCP 14, RFC 2119, March 1997.
[RFC5234] Crocker, D. and P. Overell, "Augmented BNF for Syntax
Specifications: ABNF", STD 68, RFC 5234, January 2008.
8.2. Informative References
Author's Address
Paul Kyzivat
Huawei
Email: pkyzivat@alum.mit.edu
Kyzivat Expires July 7, 2013 [Page 5]