Re: [Json] Human JSON (Hjson)

Phillip Hallam-Baker <ietf@hallambaker.com> Mon, 30 May 2016 02:02 UTC

Return-Path: <hallam@gmail.com>
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 214B112D0E0 for <json@ietfa.amsl.com>; Sun, 29 May 2016 19:02:07 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.4
X-Spam-Level:
X-Spam-Status: No, score=-2.4 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.198, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id csAFqxE6HkJ0 for <json@ietfa.amsl.com>; Sun, 29 May 2016 19:02:05 -0700 (PDT)
Received: from mail-qk0-x235.google.com (mail-qk0-x235.google.com [IPv6:2607:f8b0:400d:c09::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 860B112B013 for <json@ietf.org>; Sun, 29 May 2016 19:02:05 -0700 (PDT)
Received: by mail-qk0-x235.google.com with SMTP id n63so114114911qkf.0 for <json@ietf.org>; Sun, 29 May 2016 19:02:05 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc; bh=EC5LXasZMmaF3MvzheDep2DwcMdFcw2JKbuP2E5llGU=; b=ZaKp/LbMKMoDISqUaSO3M1BIUqYDqTZ097C/2DBuEIdg++79EQHHc6jEA4KNb01t+c +e7AAW1Wf7sqerF6y7P/Tw59i6tfJGdc+SQM2cJnjlON6ANTcb16rz/VN5notE9Ijmfi bZkUoqqf48yitV3mNVGSmGr+ITo228g57xGHt19l1UY+G3lg86KcACV1AWeXSn3UajN3 ZBKvnNj6GOStFDbcWK+o5J48jPeUycL45So9eBKjvZr8KTgbxhyS6wPcRsTyVEneBblw Ia4WfemxSBGj7E+IeUQHWmxTWZ4gMNMnVUybaG670Fn93PlgzHbgNb1673JoMIVCYj9E RnUw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:date :message-id:subject:from:to:cc; bh=EC5LXasZMmaF3MvzheDep2DwcMdFcw2JKbuP2E5llGU=; b=JYjQMHm6g1cPzJ4y1IUfecu+RJSQAQoTbA7/hZCl477e6N83p0dQxJvdW+OOrsdH6r tOaSbIcsYNYspfCeumukhks4UX6ZMIb+4MpFYiQvmMUKkZG+tFHoi4u6/rEL6AkW6VHB SGLMTvin7htlXSsaTfChwe2w1+jpqj/GblE9467F4jj1ZueHFWuy2S1+J+9EU8AgG0Eh zgJbeY7lLCAvBE6/M5sEIcftavm4bVxVypxV8Zjv6i8ffZ5bTap8keJHDv3QPGzgvvLp BEVNUSevreLWbkyl88ZF+NvCBqEKGaXZFB7cqOz8IaUliN/gKvJPO6iMBQfYc5n+NFfF B1xA==
X-Gm-Message-State: ALyK8tJ5zMNcfbymboISURFvnepCW/2K060VRLlJxtYPgM+44f4n7x8pdDskQnRfzj0SYBsndwYTMCEj8pkYeQ==
MIME-Version: 1.0
X-Received: by 10.200.54.170 with SMTP id a39mr23577115qtc.104.1464573724684; Sun, 29 May 2016 19:02:04 -0700 (PDT)
Sender: hallam@gmail.com
Received: by 10.55.25.85 with HTTP; Sun, 29 May 2016 19:02:04 -0700 (PDT)
In-Reply-To: <e5413a74-ad74-42e7-46a0-ab115af7d2f1@it.aoyama.ac.jp>
References: <9ec25767-7471-2ca3-ded5-afed67863742@gmail.com> <82b2ba3f-a6c2-c98b-b365-b698ab285149@codalogic.com> <CAMm+Lwjw-FgrH1yED5B98=3vsx_KjX_VANn=7efPVoD_yPcC1w@mail.gmail.com> <57471154.1050107@tzi.org> <574711EE.2010405@tzi.org> <CAMm+LwgdV3w=eRjFEdsbfkuCw_D2rw8rUgdgeVYAmLJPtPxRKQ@mail.gmail.com> <e5413a74-ad74-42e7-46a0-ab115af7d2f1@it.aoyama.ac.jp>
Date: Sun, 29 May 2016 22:02:04 -0400
X-Google-Sender-Auth: _rLfG6FIAo1ENZZOkVv7G5uoMig
Message-ID: <CAMm+LwhfBD4pJG_n5f=eCSZHcvPfx29v0_YHeezTTjHr+SJaVQ@mail.gmail.com>
From: Phillip Hallam-Baker <ietf@hallambaker.com>
To: =?UTF-8?Q?Martin_J=2E_D=C3=BCrst?= <duerst@it.aoyama.ac.jp>
Content-Type: multipart/alternative; boundary=001a1141a6129b75dc053405a4c0
Archived-At: <http://mailarchive.ietf.org/arch/msg/json/pKpItFAap7oYdpmt7OSjoMw3-Uc>
Cc: Carsten Bormann <cabo@tzi.org>, JSON WG <json@ietf.org>
Subject: Re: [Json] Human JSON (Hjson)
X-BeenThere: json@ietf.org
X-Mailman-Version: 2.1.17
Precedence: list
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: <https://mailarchive.ietf.org/arch/browse/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: Mon, 30 May 2016 02:02:07 -0000

On Sun, May 29, 2016 at 9:56 PM, Martin J. Dürst <duerst@it.aoyama.ac.jp>;
wrote:

> On 2016/05/27 00:36, Phillip Hallam-Baker wrote:
>
> So the following would all be equivalent:
>>
>> { "Tag1" : { "Tag2" : { "Tag3" : "Data" } } }
>>
>> Tag1
>>     Tag2
>>         Tag3 "Data"
>>
>> Tag1 { "Tag2" : { "Tag3" : "Data" } } }
>>
>>
>> The second version is pretty much the Goedel syntax. I can show that is
>> unambiguous as I define it as a FSM and then produce the grammar from the
>> FSM.
>>
>
> Just a quick comment: As far as I understand, a FSM (finite state machine)
> isn't able to grok any of the above, unless you limit the number of
> indentation/nesting levels. An FSM leads to a regular grammar, whereas a
> context-free grammar is needed to parse nesting constructs with arbitrary
> depth. The corresponding automaton is a push-down automaton.
>
> Regards,   Martin.
>

You have to add a stack. But you have to do that to parse JSON anyway to
parse the braces.

Indentation delimited is pretty easy to code, just count leading spaces, if
the number increases, emit a brace, if it reduces emit as many braces as
necessary