Progress on portability: getting rid of define-macros

[email protected] Fri, 31 Oct 2003 11:58:55 -0800 (PST)
Newsgroups gmane.lisp.scheme.ssax-sxml
Message-ID <[email protected]>
Hello!

I'd like to report on the work of making the entire SSAX code base, as
it is, portable to any R5RS system. The sole impediment to this goal
is low-level macros. It seems a milestone has been reached: the input
parsing library, utilities, SXML transformation code, and the
regression tests are now free (in general branches) from low-level
macros. As a proof of that, the entire code base of SSAX but SSAX.scm
runs on Petite Chez Scheme. All regression tests pass.

As has been proposed and discussed on this list, define-opt has been
moved from input-parse.scm to the myenv* preludes. This form -- define
with an optional arguments -- has been improved. In now complies with
a relevant subset of DSSSL: if we take DSSSL's extended define, keep
only the #!optional feature and write #!optional arg1 ... as (optional
arg1 ...), we get define-opt. The new define-opt permits any number of
optional arguments, including zero. Everything that DSSSL says about
optional arguments equally applies to define-opt. Also, define-opt is
totally backward-compatible with define: In _any_ Scheme code,
replacing 'define' binding form with 'define-opt' will not change the
behavior of that code. There are two implementations of define-opt:
one for a system that supports DSSSL extensions (in which case
define-opt expands into the DSSSL-extended define), and the other is
for any R5RS system. The latter implementation is, of course, a
syntax-rule. It is tested on SCM, Petite Chez Scheme and Scheme48.


In all the SSAX code (with the sole exception of SSAX.scm), low-level
macros remain only within cond-expand blocks that pertain to Bigloo
and Gambit. I'm a bit uncertain how Bigloo handles syntax-rules, given
the warnings in the Bigloo documentation. The SSAX-SXML code is
otherwise free from low-level macros.

The standard prelude for SCM, myenv-scm.scm, has been completely
re-written to replace defmacros with syntax-rules. SCM passes all the
tests.

To truly verify that no traces of low-level macros remain in the
general branch of the code, I have run all the regression tests
(excluding SSAX.scm) on Petite Chez system. The latter does not
support define-macros natively at all. I had to write the
myenv-chez.scm file.

I have also replaced two low-level macros in SSAX.scm with
syntax-rules. I have claimed that one macro, run-test, cannot be
expressed with syntax-rules. Well, in full generality, it can't; but
as far as SSAX regression tests are concerned, it can. The problem was
of course the notation '"Aa" for a portable case-sensitive symbol.
The changed SSAX.scm file is not committed yet. All the other changes
are committed to the SSAX CVS repository. SSAX/lib/myenv-chez.scm is new
and SSAX/lib/myenv-scm.scm is totally re-written.

The upshot: everything that worked works. SCM now relies on
syntax-rules rather than defmacros. Petite Chez Scheme runs and
validates the utilities, SXML transformation, and the input parsing
library. The latter fact seems to indicate that the code is portable
to any R5RS system.



-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?   SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/