From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12173 invoked by alias); 27 Jan 2005 18:30:13 -0000 Mailing-List: contact cgen-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cgen-owner@sources.redhat.com Received: (qmail 10410 invoked from network); 27 Jan 2005 18:29:02 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org with SMTP; 27 Jan 2005 18:29:02 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11/8.12.11) with ESMTP id j0RIT2Jf007408 for ; Thu, 27 Jan 2005 13:29:02 -0500 Received: from zenia.home.redhat.com (sebastian-int.corp.redhat.com [172.16.52.221]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id j0RIT0O23626; Thu, 27 Jan 2005 13:29:01 -0500 To: cgen@sources.redhat.com Subject: Porting CGEN to other Scheme implementations From: Jim Blandy Date: Thu, 27 Jan 2005 18:30:00 -0000 Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2005-q1/txt/msg00010.txt.bz2 I'm interested in porting CGEN to MzScheme. MzScheme has an active development community, and (of particular interest to Red Hat) an actively maintained Scheme-to-C compiler. I'd like to talk about how I'm thinking of approaching it, and see what folks think. I'd like to convert CGEN to use standard R5RS scheme where possible, and have a per-implementation file --- guile.scm or mzscheme.scm --- that is loaded before anything else that can define or fix things as necessary. The only big issue here is CGEN's use of Guile keywords. Standard Scheme doesn't have keywords at all. Common Lisp allows one to customize the reader pretty heavily, and I assume that has been imitated in some Scheme systems, but R5RS Scheme does not, and MzScheme only allows you to replace the reader entirely. The "R5RS wherever possible" approach suggests that CGEN simply stop using Guile keywords, and use symbols whose names begin with :, or something like that, instead. Older Guiles used to recognize :foo as a keyword object, but that was made optional and disabled by default, since there is Scheme code out there that uses symbols whose names start with : as symbols. I've gotten this working for cgen-sid.scm, and it wasn't too bad. It entailed: - defining a 'cgen-keyword?' function - replacing #:foo with either :foo or ':foo - looking for cases where we check (symbol? foo) before we check (keyword? foo) We'll need some way to produce a helpful warning when people read old .cpu files with a new CGEN. At the moment, to build SID files, for example, we invoke Guile like this: guile -s cgen-sid.scm The '-s SCRIPT' terminates Guile's argument parsing and passes the remaining arguments to the script itself. I'd like to change the cgen-FOO.scm scripts to expect to be invoked like this: guile -l ${cgensrc}/guile.scm -s cgen-sid.scm or mzscheme -f ${cgensrc}/mzscheme.scm -r cgen-sid.scm which have the effect you'd guess. guile.scm and mzscheme.scm are new files that would get loaded first, and could do whatever compatibility trickery was needed. Most of the stuff in fixup.scm, and some stuff from read.scm, would move to the new guile.scm. Thoughts? Objections to the whole enterprise? Doughnuts?