From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: tb@becket.net (Thomas Bushnell, BSG) Newsgroups: gmane.lisp.guile.user Subject: Re: language translator help Date: 26 Apr 2002 14:14:22 -0700 Sender: guile-user-admin@gnu.org Message-ID: <874rhyp3gx.fsf@becket.becket.net> References: <15561.38014.967466.255795@segfault.bogus.domain> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1019855902 25492 127.0.0.1 (26 Apr 2002 21:18:22 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Fri, 26 Apr 2002 21:18:22 +0000 (UTC) Return-path: Original-Received: from fencepost.gnu.org ([199.232.76.164]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 171D6k-0006d3-00 for ; Fri, 26 Apr 2002 23:18:22 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 171D5j-0002HW-00; Fri, 26 Apr 2002 17:17:19 -0400 Original-Received: from vp190174.reshsg.uci.edu ([128.195.190.174] helo=becket.becket.net) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 171D17-00024E-00 for ; Fri, 26 Apr 2002 17:12:33 -0400 Original-Received: from tb by becket.becket.net with local (Exim 3.35 #1 (Debian)) id 171D2s-0000Xw-00; Fri, 26 Apr 2002 14:14:22 -0700 Original-To: "John W. Eaton" , guile-user@gnu.org X-Reply-Permission: Posted or emailed replies to this message constitute permission for an emailed response. X-PGP-Fingerprint: 1F0A1E51 63 28 EB DA E6 44 E5 5E EC F3 04 26 4E BF 1A 92 X-Windows: It was hard to write; it should be hard to use. In-Reply-To: <15561.38014.967466.255795@segfault.bogus.domain> Original-Lines: 20 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Errors-To: guile-user-admin@gnu.org X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.0.9 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.lisp.guile.user:324 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.user:324 My translator is a Scheme program that parses and reads Python, and turns it into Scheme. "Turns it into scheme" means not that it writes ASCII and uses the Scheme reader; of course it just uses cons to make forms. That's the Right Thing. The way to translate break, goto, and such is indeed with call/cc (or, if you're a fan of it, using call/ec). Scoping is best handled by doing it by hand. I have python variables *not* as scheme variables, but rather as just indexes in a table. A python variable ref is then compiled into a lookup in that table. A more clever compiler could detect safe cases where it can just be a Scheme variable. Global variables are handled differently: each language's globals show up as a subset of the globals of the other language, and compilation of Python into Scheme replaces the pythony names with the Schemey ones. _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://mail.gnu.org/mailman/listinfo/guile-user