X-Mozilla-Status: 0001
X-Mozilla-Status2: 00000000
Delivered-To: barryleiba.mailing.lists@gmail.com
Received: by 10.59.3.41 with SMTP id bt9csp238738ved;
        Fri, 4 Jan 2013 12:13:16 -0800 (PST)
X-Received: by 10.68.209.230 with SMTP id mp6mr163995390pbc.8.1357330395934;
        Fri, 04 Jan 2013 12:13:15 -0800 (PST)
Return-Path: <abnf-discuss-bounces@ietf.org>
Received: from mail.ietf.org (mail.ietf.org. [2001:1890:126c::1:1e])
        by mx.google.com with ESMTP id d3si51945916paw.215.2013.01.04.12.13.14;
        Fri, 04 Jan 2013 12:13:15 -0800 (PST)
Received-SPF: pass (google.com: domain of abnf-discuss-bounces@ietf.org designates 2001:1890:126c::1:1e as permitted sender) client-ip=2001:1890:126c::1:1e;
Authentication-Results: mx.google.com; spf=pass (google.com: domain of abnf-discuss-bounces@ietf.org designates 2001:1890:126c::1:1e as permitted sender) smtp.mail=abnf-discuss-bounces@ietf.org; dkim=pass (test mode) header.i=@ietf.org
Received: from ietfa.amsl.com (localhost [127.0.0.1])
	by ietfa.amsl.com (Postfix) with ESMTP id B3DED21F8A8E;
	Fri,  4 Jan 2013 12:13:14 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ietf.org; s=ietf1;
	t=1357330394; bh=r1j1A5C93CsLKZOP8pK5A6rLu8slD+XgmNb929a6Wx4=;
	h=Message-ID:Date:From:MIME-Version:To:References:In-Reply-To:
	 Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:
	 List-Subscribe:Content-Transfer-Encoding:Content-Type:Sender;
	b=flNzjk2YkImwaQNDoDpttF5xXG8kcKZzioMJC9WKc7fD55GWwHqjMlfjWoeRvGSr5
	 cRP+FVu7vXqMDrXo3AtjXKxu1myayTjwin6xeqMTOaaHmbw9S2wfEKrlW4PfPjisi0
	 /BMgFwNDX3Ex18lSDVw+P6xUClSl3fnIy5nT3Xns=
X-Original-To: abnf-discuss@ietfa.amsl.com
Delivered-To: abnf-discuss@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1])
	by ietfa.amsl.com (Postfix) with ESMTP id 3A83721F8A6F
	for <abnf-discuss@ietfa.amsl.com>; Fri,  4 Jan 2013 12:13:12 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: 0.675
X-Spam-Level: 
X-Spam-Status: No, score=0.675 tagged_above=-999 required=5 tests=[AWL=-0.088, 
	BAYES_00=-2.599, FH_RELAY_NODNS=1.451, HELO_MISMATCH_NET=0.611, 
	J_CHICKENPOX_45=0.6, J_CHICKENPOX_57=0.6, RDNS_NONE=0.1]
Received: from mail.ietf.org ([64.170.98.30])
	by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id oiAEk7M9huxz for <abnf-discuss@ietfa.amsl.com>;
	Fri,  4 Jan 2013 12:12:48 -0800 (PST)
Received: from qmta02.westchester.pa.mail.comcast.net
	(qmta02.westchester.pa.mail.comcast.net
	[IPv6:2001:558:fe14:43:76:96:62:24])
	by ietfa.amsl.com (Postfix) with ESMTP id AC5EB21F8A42
	for <abnf-discuss@ietf.org>; Fri,  4 Jan 2013 12:12:35 -0800 (PST)
Received: from omta12.westchester.pa.mail.comcast.net ([76.96.62.44])
	by qmta02.westchester.pa.mail.comcast.net with comcast
	id juB21k0060xGWP851wCY4D; Fri, 04 Jan 2013 20:12:32 +0000
Received: from Paul-Kyzivats-MacBook-Pro.local ([50.138.229.164])
	by omta12.westchester.pa.mail.comcast.net with comcast
	id jwCY1k0073ZTu2S3YwCYot; Fri, 04 Jan 2013 20:12:32 +0000
Message-ID: <50E737AF.30102@alum.mit.edu>
Date: Fri, 04 Jan 2013 15:12:31 -0500
From: Paul Kyzivat <pkyzivat@alum.mit.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:17.0) Gecko/17.0 Thunderbird/17.0
MIME-Version: 1.0
To: abnf-discuss@ietf.org
References: <20130103171755.20983.75939.idtracker@ietfa.amsl.com>
	<50E5BF59.9000207@alum.mit.edu> <50E5D4C5.8010800@alum.mit.edu>
	<tk0GjBDTOy5QFAkk@paul.bayleaf.org.uk>
In-Reply-To: <tk0GjBDTOy5QFAkk@paul.bayleaf.org.uk>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net;
	s=q20121106; t=1357330352;
	bh=wuQ8t6S0P4G45cpaFItoAeaBvlrZqO4lA6VEeFk5zgE=;
	h=Received:Received:Message-ID:Date:From:MIME-Version:To:Subject:
	Content-Type;
	b=iEOdXuqBtxmahNIIKVouuzECw0W9D653b+8tYdCTQliD0q8j2+YyMvGeAzVcgEL4e
	Lr5YSZaq0aQh9V3tZX6jh3rJW79o2It0Rx1MsWFuLPaZ1GzaoBoeHw+5V5qan4MW76
	8EC9q27OHcbs24kehA5INCn/aYyYJq1mOiK0PwRcsUSTf2lbQ9zc/hqKArCCP70ssp
	Nk4T+m9ODNvgGq0xwheavjBN50RykE+49+Cg4V35+gZm2nZlBCkPy1xf0igay+Oc1Q
	Om51i1wEae8BksgIupRlZ8/Ycefw/XHAQvQDdV5ccPZYX3jeRKO3ETdU8XC9Kqp4XH
	i9J6gZEEvSRmw==
Subject: Re: [abnf-discuss] A proposal for adding import and scopping to ABNF
X-BeenThere: abnf-discuss@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: "General discussion about tools,
	activities and capabilities involving the ABNF meta-language"
	<abnf-discuss.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/abnf-discuss>,
	<mailto:abnf-discuss-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/abnf-discuss>
List-Post: <mailto:abnf-discuss@ietf.org>
List-Help: <mailto:abnf-discuss-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/abnf-discuss>,
	<mailto:abnf-discuss-request@ietf.org?subject=subscribe>
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="us-ascii"; Format="flowed"
Sender: abnf-discuss-bounces@ietf.org
Errors-To: abnf-discuss-bounces@ietf.org

Inline

On 1/4/13 1:46 PM, Paul Overell wrote:
>
> Hi,
>
> In message <50E5D4C5.8010800@alum.mit.edu>, Paul Kyzivat
> <pkyzivat@alum.mit.edu> writes
>
> I think this is a very interesting idea, to formalize import and export
> of ABNF between documents.  Some thoughts, questions and quibbles:
>
>
> 1)
>
>>       named-rulelist =
>>          rulelist-name *WSP "{" rulelist "}" c-nl
>>
>>       rulelist-import =
>>          (basic-import / named-import) c-nl
>
> I think there is a minor problem with the syntax here, it doesn't allow
> *WSP before the c-nl.

Yeah, you seem to be right. Would you be happy with:

      named-rulelist =
          rulelist-name *WSP "{" rulelist "}" *WSP c-nl

       rulelist-import =
          (basic-import / named-import) *WSP c-nl


>  But be very careful when fixing this as the
> original syntax contains some ambiguity concerning white space, which is
> subject to an errata:
> http://www.rfc-editor.org/errata_search.php?rfc=5234&rec_status=2&present
> ation=records.
>
> 2)
>
>>   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"
>>
>>      is equivalent to:
>>
>>       CORE {
>>          @"urn:ietf:rfc:5234"
>>       }
>
> This doesn't seem to allow importing just a named-rulelist from another
> document.  E.g if document 1 has
> SYNTAX1 {
>     doc1syntax1 = ...
> }
> SYNTAX2 {
>     doc1syntax2 = ...
> }
>
> How do I specify in document 2 that I wish to import just SYNTAX1, and
> not SYNTAX2?
>
> The named-import seems to import ALL the ABNF from another document into
> a new namespace - or have I misunderstood?

It *doesn't* provide a way to do that.

I initially did try to do that. Fitting it into the syntax was no 
problem, but it introduces extra potential error cases (notably - 
recursive imports), and would significantly complicate an 
implementation. (You have to parse the imported file and build at least 
a partial symbol table in order to find the part you want to import. But 
then you must at least re-resolve all the rulename references in the new 
context.)

So I decided to follow the KISS principle and just leave that feature 
out. It doesn't really hurt to import more, except for efficiency. And 
efficiency isn't really an issue when processing ABNF.

> 4)

What happened to (3)?

> Have you considered an import syntax to specify importing just a
> specific rule or list of rules?  E.g. Importing from RFC5234 one might
> just want some of the core rules from Appendix B, but not want the ABNF
> Definition of ABNF in section 4.

Yes. KISS again. Also, IMO it is very unlikely that one would want to 
import just one rule. You can get a similar effect by:

CORE@"urn:ietf:rfc:5234"
ALPHA = CORE.ALPHA
DIGIT = CORE.DIGIT


> 5)
>
> What are the semantics of importing a rulelist that itself imports a
> rulelist?  Is circularity allowed (doc1 import from doc2, doc2 imports
> from doc1)?  If so is a parser expected to detect circularity to avoid
> an infinite loop?

As mentioned above, this is one reason I abandoned importing specific 
named rulesets.

The parser needs to detect this well enough to avoid crashing by running 
out of resources.

Recursion can be detected by, at the time of import, searching up the 
stack of in-progress imports for a file with the same name. If found, 
abort the import and report an error.

This works *because* the import is all-or nothing, rather than by 
selectively importing a named-rulelist. If that is supported then it 
gets much more complicated.

	Thanks,
	Paul K

_______________________________________________
abnf-discuss mailing list
abnf-discuss@ietf.org
https://www.ietf.org/mailman/listinfo/abnf-discuss

