Re: [Json] ABNF nits

Stefan Drees <stefan@drees.name> Fri, 07 June 2013 09:08 UTC

Return-Path: <stefan@drees.name>
X-Original-To: json@ietfa.amsl.com
Delivered-To: json@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id B6A1721F9485 for <json@ietfa.amsl.com>; Fri, 7 Jun 2013 02:08:59 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.099
X-Spam-Level:
X-Spam-Status: No, score=-2.099 tagged_above=-999 required=5 tests=[AWL=-0.150, BAYES_00=-2.599, HELO_EQ_DE=0.35, MIME_8BIT_HEADER=0.3]
Received: from mail.ietf.org ([12.22.58.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id aHxBp6rU7tBg for <json@ietfa.amsl.com>; Fri, 7 Jun 2013 02:08:53 -0700 (PDT)
Received: from mout.web.de (mout.web.de [212.227.15.3]) by ietfa.amsl.com (Postfix) with ESMTP id 2748321F92B8 for <json@ietf.org>; Fri, 7 Jun 2013 02:08:52 -0700 (PDT)
Received: from newyork.local.box ([93.129.186.5]) by smtp.web.de (mrweb101) with ESMTPSA (Nemesis) id 0MCqsR-1UcJp303P9-009gwU; Fri, 07 Jun 2013 11:08:43 +0200
Message-ID: <51B1A317.4060105@drees.name>
Date: Fri, 07 Jun 2013 11:08:39 +0200
From: Stefan Drees <stefan@drees.name>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130509 Thunderbird/17.0.6
MIME-Version: 1.0
To: "\"Martin J. Dürst\"" <duerst@it.aoyama.ac.jp>
References: <255B9BB34FB7D647A506DC292726F6E1151B21F79E@WSMSG3153V.srv.dir.telstra.com> <A723FC6ECC552A4D8C8249D9E07425A70FC326C8@xmb-rcd-x10.cisco.com> <255B9BB34FB7D647A506DC292726F6E1151B21F8CA@WSMSG3153V.srv.dir.telstra.com> <51B17E54.9030107@drees.name> <51B19672.8040706@it.aoyama.ac.jp>
In-Reply-To: <51B19672.8040706@it.aoyama.ac.jp>
Content-Type: text/plain; charset="ISO-8859-1"; format="flowed"
Content-Transfer-Encoding: 8bit
X-Provags-ID: V03:K0:tKTuz98j+8h3MKinT/ti4eP3kWrbz1cdG15nsa+Lwm9mq8WT6zK W95BA649YtKB7DgsoXKixuLvhDYcgRa3MAnbhQvKNsAaqP6UH4YEO9BvqAtaubpfZjel9tq bNx+Gum27qaQ/YYkn7mP43p3DWzaN35ng9gjarWZnwn/pL6GI7YcIMbCUqWXQf3GPvsgVp7 Fj/3yKtlzOCx6tHmmPWeQ==
Cc: "Manger, James H" <James.H.Manger@team.telstra.com>, "Joe Hildebrand (jhildebr)" <jhildebr@cisco.com>, "json@ietf.org" <json@ietf.org>
Subject: Re: [Json] ABNF nits
X-BeenThere: json@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
Reply-To: stefan@drees.name
List-Id: "JavaScript Object Notation \(JSON\) WG mailing list" <json.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/json>, <mailto:json-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/json>
List-Post: <mailto:json@ietf.org>
List-Help: <mailto:json-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/json>, <mailto:json-request@ietf.org?subject=subscribe>
X-List-Received-Date: Fri, 07 Jun 2013 09:09:00 -0000

On 2013-06-07 10:14, Martin J. Dürst wrote:
> On 2013/06/07 15:31, Stefan Drees wrote:
>
>> If defining a grammar with real case-sensitive "word"-ish tokens in it,
>> ABNF is IMO barely usable, unless you extend it with say single quotes
>> as case-sensitve string delimiters. But then dealing with two kinds of
>> strings also has it's catches =(
>
> Another way to do this is to just note that you are using ABNF *except
> that literals are case-sensitive*.

Piece of cake, if all words are case sensitive, but the devil is in the 
mix. As I stated above "with ... case-sensitive ... tokens in it" on 
purpose, and not "with ... case-sensitive ... tokens only" ;-)

That is a situation where I prefer eg. ANTLR stating an easy to parse
tokenCS: 'CaseSensitive' nicely different from the more varying
tokenCIS: [Cc][Aa][Ss][Ee][Ii][Nn][Ss][Ee][Nn][Ss][Ii][Tt][Ii][Vv][Ee]

But I think readability is in the eye of the reader and for JSON the 
grammar is set to be ABNF which is also fully sufficient.


> I'm sure there's an RFC or two which have done so. ...

To the enlightment of the readers, when feeding such a grammar into an 
ABNF tool =( I presume ...

In Open Data we settled in the ABNF URL construction rules[1] for the 
upcoming version 4 on an explicit differentiating strategy and also 
provided a tool (adaption) [2] for translating into real ABNF.



References:

[1]: 
https://tools.oasis-open.org/version-control/browse/wsvn/odata/trunk/spec/ABNF/odata-abnf-construction-rules.txt?rev=356&sc=1
[2]: https://github.com/SAP/abnf-test-tool

All the best,
Stefan.