From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Israelsson Tampe Newsgroups: gmane.lisp.guile.devel Subject: Re: syntax-local-value patch for discussion Date: Thu, 19 Jan 2012 10:50:47 +0100 Message-ID: References: <87fwfq6m5x.fsf@netris.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=0016364c6ecfaf71a204b6de7f70 X-Trace: dough.gmane.org 1326966671 24796 80.91.229.12 (19 Jan 2012 09:51:11 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 19 Jan 2012 09:51:11 +0000 (UTC) To: guile-devel Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Thu Jan 19 10:51:08 2012 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Rnoe8-00013z-Vp for guile-devel@m.gmane.org; Thu, 19 Jan 2012 10:51:05 +0100 Original-Received: from localhost ([::1]:37241 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rnoe8-0000sj-7f for guile-devel@m.gmane.org; Thu, 19 Jan 2012 04:51:04 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:41413) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rnodz-0000sR-Qr for guile-devel@gnu.org; Thu, 19 Jan 2012 04:51:01 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rnodu-0000O3-2j for guile-devel@gnu.org; Thu, 19 Jan 2012 04:50:55 -0500 Original-Received: from mail-ee0-f41.google.com ([74.125.83.41]:64246) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rnodt-0000Nu-Sy for guile-devel@gnu.org; Thu, 19 Jan 2012 04:50:50 -0500 Original-Received: by eekc13 with SMTP id c13so1629684eek.0 for ; Thu, 19 Jan 2012 01:50:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=pzc+I6Dzqka8KGtrC3AwcI5jAR9yPa2Xy66sOExE0VI=; b=vR0ezjksKlsEQGJEATALi3wEWebyUP6MxxeozVDIKE6YTrVaO7X572iKZt1oX70mhe u2xO/xKaDyybAfcAXnBCt0bRqw9cotoRGdyZ7gjEPkVqLo0gqG1Rt/Arrv3rZuZ+J3FO FMtZHwrwfg3u8pV9cBDRgh70W4YE5XVq8Hb+c= Original-Received: by 10.14.9.228 with SMTP id 76mr1466386eet.18.1326966648041; Thu, 19 Jan 2012 01:50:48 -0800 (PST) Original-Received: by 10.213.33.77 with HTTP; Thu, 19 Jan 2012 01:50:47 -0800 (PST) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 74.125.83.41 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:13582 Archived-At: --0016364c6ecfaf71a204b6de7f70 Content-Type: text/plain; charset=ISO-8859-1 Hi, Working on porting syntax-parse is a learning experience and I know understand how it uses syntax-local-value as a way to lookup a syntax object by joining the wraps together with the total wrap at the macro call. The question is if this really are the total wrap e.g. contains the history of all the previous variable and macro and syntax definitions. Is this so or are it a partial part of the history? Anyway syntax-parse works by defining pattern variables the hard core way and I have now changed that to a more standard way of implementation leading to skipping syntax-local-value (variables are stored in a struct and they does then not contain the correct wrap) but instead examine the syntax variables used and transport the wraps of the containing syntax variable of the struct. For this I have a messy and sloppy algorithm just to make it work - but I would like to have a syntax-join function that takes two syntax objects and join them correctly and robustly in the pressense of eventual marks or not. Anyway this now works, (define-syntax-class t (pattern (x:id y))) (define-syntax a (lambda (x) (syntax-parse x ((_ z:t ...) #'(+ z.y ...))))) (a (x1 1) (x2 2) (x3 3)) $1 = 6 /Stefan --0016364c6ecfaf71a204b6de7f70 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi,

Working on porting syntax-parse is a learning experience and I k= now understand how it uses
syntax-local-value as a way to lookup a synta= x object by joining the wraps together with the
total wrap at the macro = call.

The question is if this really are the total wrap e.g. contains the his= tory of all the previous variable
and macro and syntax definitions. Is t= his so or are it a partial part of the history?

Anyway syntax-parse = works by defining pattern variables the hard core way and I have now change= d that
to a more standard way of implementation leading to skipping syntax-local-v= alue (variables are stored in
a struct and they does then not contain th= e correct wrap) but instead examine the syntax variables used
and transp= ort the wraps of the containing syntax variable of the struct. For this I h= ave a messy and sloppy
algorithm just to make it work - but I would like to have a syntax-join fun= ction that takes two syntax objects
and join them correctly and robustly= in the pressense of eventual marks or not.

Anyway this now works,
(define-syntax-class t (pattern (x:id y)))
(define-syntax a (lambda = (x) (syntax-parse x ((_ z:t ...) #'(+ z.y ...)))))
(a (x1 1) (x2 2) = (x3 3))
$1 =3D 6

/Stefan
--0016364c6ecfaf71a204b6de7f70--