From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.org!not-for-mail
From: Andy Wingo <wingo@pobox.com>
Newsgroups: gmane.lisp.guile.user
Subject: Re: json parser
Date: Sat, 28 Aug 2010 16:55:59 -0700
Message-ID: <m3r5hi1ecw.fsf@unquote.localdomain>
References: <n2y4754958d1004011839g6814044dm672d28c010dbbbfe@mail.gmail.com>
NNTP-Posting-Host: lo.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Trace: dough.gmane.org 1283040040 1095 80.91.229.12 (29 Aug 2010 00:00:40 GMT)
X-Complaints-To: usenet@dough.gmane.org
NNTP-Posting-Date: Sun, 29 Aug 2010 00:00:40 +0000 (UTC)
Cc: guile-user@gnu.org
To: Corey Thomasson <cthom.lists@gmail.com>
Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Sun Aug 29 02:00:37 2010
Return-path: <guile-user-bounces+guile-user=m.gmane.org@gnu.org>
Envelope-to: guile-user@m.gmane.org
Original-Received: from lists.gnu.org ([199.232.76.165])
	by lo.gmane.org with esmtp (Exim 4.69)
	(envelope-from <guile-user-bounces+guile-user=m.gmane.org@gnu.org>)
	id 1OpVK8-0006M5-Ol
	for guile-user@m.gmane.org; Sun, 29 Aug 2010 02:00:37 +0200
Original-Received: from localhost ([127.0.0.1]:56981 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43)
	id 1OpVK8-0008AX-5P
	for guile-user@m.gmane.org; Sat, 28 Aug 2010 20:00:36 -0400
Original-Received: from [140.186.70.92] (port=59868 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1OpVJx-00083k-Ro
	for guile-user@gnu.org; Sat, 28 Aug 2010 20:00:26 -0400
Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <wingo@pobox.com>) id 1OpVCZ-0000mS-AB
	for guile-user@gnu.org; Sat, 28 Aug 2010 19:52:48 -0400
Original-Received: from a-pb-sasl-quonix.pobox.com ([208.72.237.25]:54858
	helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <wingo@pobox.com>) id 1OpVCZ-0000mL-8H
	for guile-user@gnu.org; Sat, 28 Aug 2010 19:52:47 -0400
Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1])
	by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id 2A418D1C08;
	Sat, 28 Aug 2010 19:52:46 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc
	:subject:references:date:in-reply-to:message-id:mime-version
	:content-type; s=sasl; bh=jqVrQoOb8Jx47aNQXfVSPpDFYEI=; b=Sp8vDt
	vqOBQy2K5h9rLJdQA1p+swx9DjQtU4IYKb5Kc8xZySYOP9q0B+eJSD2ypzbn/v9/
	d7w4bkJw+hMc5o/AkYXKFJZwdiGsKdwN/l9D97DYTipegNy62LheE0rswUWW/X9F
	g1NbSiDtQjxaZeM5oYT7wWelC86PpNxLvGaes=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc
	:subject:references:date:in-reply-to:message-id:mime-version
	:content-type; q=dns; s=sasl; b=obTb0D6bh8cwFiJQFyd9DUuRw/AjPf3n
	6fNRfJUnDzuuJIcZT5FVaRWaIHr6j6GvHR1POuQ4O1Gepl+sgNyko1lNrraPe931
	nXf1CnvsRNgfwOlhRX2EEfT82ChUHcHeqDTM4jZ1k3DxiO/ptTEbgm818X1zObIa
	gKujmhSLT5Y=
Original-Received: from a-pb-sasl-quonix. (unknown [127.0.0.1])
	by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id 14F16D1C06;
	Sat, 28 Aug 2010 19:52:45 -0400 (EDT)
Original-Received: from unquote.localdomain (unknown [76.166.198.241]) (using TLSv1
	with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate
	requested) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTPSA id
	A22FDD1C05; Sat, 28 Aug 2010 19:52:43 -0400 (EDT)
In-Reply-To: <n2y4754958d1004011839g6814044dm672d28c010dbbbfe@mail.gmail.com>
	(Corey Thomasson's message of "Thu, 1 Apr 2010 21:39:15 -0400")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)
X-Pobox-Relay-ID: 5A95395C-B2FF-11DF-94E1-030CEE7EF46B-02397024!a-pb-sasl-quonix.pobox.com
X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta)
X-BeenThere: guile-user@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: General Guile related discussions <guile-user.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/guile-user>,
	<mailto:guile-user-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/guile-user>
List-Post: <mailto:guile-user@gnu.org>
List-Help: <mailto:guile-user-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/guile-user>,
	<mailto:guile-user-request@gnu.org?subject=subscribe>
Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org
Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org
Xref: news.gmane.org gmane.lisp.guile.user:8113
Archived-At: <http://permalink.gmane.org/gmane.lisp.guile.user/8113>

Hi Corey,

On Thu 01 Apr 2010 18:39, Corey Thomasson <cthom.lists@gmail.com> writes:

> I'm new to scheme/guile, but I got tired of writing web pages in
> php/html and started poking around my shared hosts /bin. Turns out
> guile 1.8 is installed, so I got to hacking.
>
> I couldn't find any json parsers that worked with guile, so I hacked
> on together.
>
> I don't know if it works with 1.9x, or how it could be improved
> (though I'm positive it could), or how unidiomatic it is, so any
> comment/advice/criticism/ridicule is welcome.
>
> http://github.com/cthom06/guile-json

Interesting stuff :) Some comments:

 * Indentation is non-standard; you should read
   http://mumble.net/~campbell/scheme/style.txt. It's a bit
   curmudgeonly, but correct.

 * Alists would be better for objects, I think, as it's a serializable
   data structure; obviously some form of serializable map would be
   better, if Guile had them ;)

 * Use #:use-module and #:export clauses in your define-module forms.

 * In fact a number of your let statements have bad syntax; apologies
   that guile 1.8 didn't catch this for you (it would have if the code
   were executed). 2.0 would have caught it at expansion time.

There are a few more things. If we were to include this in Guile 2.0
we'd probably use an expansion-time parser/lexer generator, perhaps via
PEG.

Happy hacking,

Andy
-- 
http://wingolog.org/