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: how to implement mutual recursive parsers in syntax-parse Date: Mon, 14 May 2012 21:13:11 +0200 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=14dae934071590b7a904c003e01a X-Trace: dough.gmane.org 1337022802 22102 80.91.229.3 (14 May 2012 19:13:22 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 14 May 2012 19:13:22 +0000 (UTC) To: guile-devel Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Mon May 14 21:13:22 2012 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SU0hr-0006Ld-Uo for guile-devel@m.gmane.org; Mon, 14 May 2012 21:13:20 +0200 Original-Received: from localhost ([::1]:51375 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SU0hr-000051-9i for guile-devel@m.gmane.org; Mon, 14 May 2012 15:13:19 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:53533) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SU0ho-0008WO-QI for guile-devel@gnu.org; Mon, 14 May 2012 15:13:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SU0hn-00007e-1g for guile-devel@gnu.org; Mon, 14 May 2012 15:13:16 -0400 Original-Received: from mail-pb0-f41.google.com ([209.85.160.41]:35766) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SU0hm-00006n-PU for guile-devel@gnu.org; Mon, 14 May 2012 15:13:14 -0400 Original-Received: by pbbrp2 with SMTP id rp2so7065880pbb.0 for ; Mon, 14 May 2012 12:13:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=CjiSMnBaOHy+XEr1R6gjnReYvGtV6C5MLVwv4GLRG9Y=; b=JxCgJSmPIGTZKvDO3p5IDj0EYtFIDmYJwdD/2zWSFfY3HLpkyAVn1rorcsVQjrjXcN s90W7CD7j9hfSWweMybspTRNLpieJQbGaQq7EUYuOO6TrO0odpFuNcx0odQrG6Y5qYqW OvW97T4GxIY60Ago2Eu+WTdPaDvGlgTHjaifr7bz4RCaAKESsW2oCIQJGgiridQUPqs/ ZgMzbZ01uQoRVJ8r1Msill6FkM+lCzIpVp2R1mopbbdFABxkrZXxnLgVpJKI5BaKIh3w OcdeXR3im1gtGpP1jWk0vX5lqJETLrmB9HlFgayGL8OXhQYWsoNlhx3DHpR6Mf3jgmA9 3jiw== Original-Received: by 10.50.197.200 with SMTP id iw8mr219247igc.18.1337022791857; Mon, 14 May 2012 12:13:11 -0700 (PDT) Original-Received: by 10.50.242.102 with HTTP; Mon, 14 May 2012 12:13:11 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.160.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:14423 Archived-At: --14dae934071590b7a904c003e01a Content-Type: text/plain; charset=ISO-8859-1 I do have a cludgy fix for this but are in search for a better solution. consider the problem: (define-syntax-class a (pattern (1 x:b)) (pattern ())) (define-syntax-class b (pattern (2 x:a)) (pattern ())) the syntax class definitions above would expand to something like (begin (define parser-a code-a ...) (define-syntax a spec-a)) (begin (define parser-b code-b ...) (define-syntax b spec-b)) In racket they manage to evaluate the define-syntax forms before the define-forms cause in the expansion of code-a amd code-b they need the spec's spec-a and spec-b. Do you have any ideas how solve this. I do have a fix for problem but it is not easy to use. /Stefan --14dae934071590b7a904c003e01a Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable I do have a cludgy fix for this but are in search for a better solution.
consider the problem:

(define-syntax-class a (pattern (1 x:b)) = (pattern ()))
(define-syntax-class b (pattern (2 x:a)) (pattern ()))

the syntax class definitions above would expand to something like
(begin
=A0=A0 (define parser-a code-a ...)
=A0=A0 (define-syntax a = spec-a))

(begin
=A0=A0 (define parser-b code-b ...)
=A0=A0 (define-syntax b spec-b))

In racket they manage to evaluate t= he define-syntax forms before the define-forms cause in the expansion
of= code-a amd code-b they need the spec's spec-a and spec-b.

Do yo= u have any ideas how solve this. I do have a fix for problem but it is not = easy to use.

/Stefan

--14dae934071590b7a904c003e01a--