From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.devel Subject: Re: how to implement mutual recursive parsers in syntax-parse Date: Mon, 21 May 2012 10:25:50 +0200 Message-ID: <877gw60wkx.fsf@pobox.com> References: <87obppmgr8.fsf@pobox.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1337588775 25172 80.91.229.3 (21 May 2012 08:26:15 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 21 May 2012 08:26:15 +0000 (UTC) Cc: guile-devel To: Stefan Israelsson Tampe Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Mon May 21 10:26:12 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 1SWNwQ-0004dF-6Q for guile-devel@m.gmane.org; Mon, 21 May 2012 10:26:10 +0200 Original-Received: from localhost ([::1]:52460 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SWNwP-0002eL-Ks for guile-devel@m.gmane.org; Mon, 21 May 2012 04:26:09 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:40620) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SWNwH-0002eB-RS for guile-devel@gnu.org; Mon, 21 May 2012 04:26:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SWNwE-0006h4-RR for guile-devel@gnu.org; Mon, 21 May 2012 04:26:01 -0400 Original-Received: from a-pb-sasl-sd.pobox.com ([74.115.168.62]:50569 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SWNwE-0006ZN-IY for guile-devel@gnu.org; Mon, 21 May 2012 04:25:58 -0400 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id 22E9A7EC0; Mon, 21 May 2012 04:25:54 -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=GxRuwiMvEzy1E6nmn6A5JO12SNk=; b=Vqm2F/ FHXGpxeA145Ax8iDGLRHgmanmyGsvGxLJdzoCQppJq1lJb2Pwhntphm1lGdqMkfq vZ4Aq0EIzMmNFXu9tG9Oy6xnNPkIugmTSRFAea5pzY6JiYyOehafqOL3I8w87wBm KyMLcCtwL2L1mN0zQ+ozApicB4qOUEERsWj3Q= 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=TS+rZOCI3djWMTexzGjsBJ5eV6WjWVKN UDl6wPX57XU8+3RS5jeyzP77QTZ+O8QPU2YTI5lFslmQzjbhurCTj0OpUiq1+W3p GK+kjWDWmHjhsDX1risxJCrJmR1NGq+IjNOzua60RldIi89ZCcBQmRlC9GGd7HAv PBcr6gEssYI= Original-Received: from a-pb-sasl-sd.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id 19DE57EBF; Mon, 21 May 2012 04:25:54 -0400 (EDT) Original-Received: from badger (unknown [85.50.196.132]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTPSA id 78B9E7EBE; Mon, 21 May 2012 04:25:53 -0400 (EDT) In-Reply-To: (Stefan Israelsson Tampe's message of "Fri, 18 May 2012 23:58:49 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) X-Pobox-Relay-ID: 94A9AF7C-A31E-11E1-91B3-E981AF15ED39-02397024!a-pb-sasl-sd.pobox.com X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-Received-From: 74.115.168.62 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:14494 Archived-At: On Fri 18 May 2012 23:58, Stefan Israelsson Tampe writes: > is master supposed to expand and evaluate all the syntax defines > before expanding the defines? Yes, provided they are within one expansion unit -- i.e. a "begin" statement. Separate toplevel forms are expanded separately. > And if a plain macro is encountered at the toplevel it is expanded as > well in the first run. I don't understand exactly how the expansion > progresses so can you describe or link to a description? >From psyntax.scm: ;; At top-level, we allow mixed definitions and expressions. Like ;; expand-body we expand in two passes. ;; ;; First, from left to right, we expand just enough to know what ;; expressions are definitions, syntax definitions, and splicing ;; statements (`begin'). If we anything needs evaluating at ;; expansion-time, it is expanded directly. ;; ;; Otherwise we collect expressions to expand, in thunks, and then ;; expand them all at the end. This allows all syntax expanders ;; visible in a toplevel sequence to be visible during the ;; expansions of all normal definitions and expressions in the ;; sequence. ;; Cheers, Andy -- http://wingolog.org/