Subject: Re: free lisp compilers?
From: (Rob Warnock)
Date: 1999/09/05
Newsgroups: comp.lang.lisp
Message-ID: <7qtmfh$>
Craig Brozefsky  <> wrote:
| Having just come off a 6 month project in a non-lisp language, the
| things that is most immediate in my mind is the grunt work required to
| code in this other language because I could not do the neccesarry
| programming to reduce the code required in a significant manner.
| Because there was not a real macro system (and for other reasons
| inherent in the language we were using) I had to do things like
| maintain 3 seperate files describing the same componnent.  Had this
| been done in Lisp, a domain language for describing these components
| would have made me only have to describe them once, in one location,
| and that would have saved me many many hours synchronizing and
| tracking down inconsistencies between the different views of the component.

You *can* still do a sort of DEFSYSTEM in Lisp, you know, even if you
have to deliver the project in language "Z". Just go ahead and write --
in Lisp -- meta-code that generates the needed sources in "Z", e.g.,
source code, header files, "i18n" message files, whatever. While it's
in your hands, you'll reap the benefits, and even after maintenance
passes over to "Z-only" coders, with a little care on the formats you
generate it won't be any harder for them to maintain (and may even be
easier! -- because of regularities) than code written directly in "Z".

Aubrey Jaffer (author of SCM) talks a bit about that approach in
<URL:> w.r.t. "Schlep",
a small Scheme-to-C "compiler" (one might almost say "macro-expander"!):

	"I almost never write C code directly anymore. I only mess with it
	to fix bugs. As with all the code I produce for jobs, the new code
	for SCM (the only thing recently has been bignum logical operations)
	is generated or at least started from the output of my schlep.scm (41k)

	"I spent some effort to make Schlep produce formatted C code; Most
	programmers I work with are not fluent in Scheme and they have to
	be able to understand my code contributions."

Writing such a tool isn't a huge effort. I know, since after using Schlep
for a short while I got fed up with its ad hoc Hungarian type system and
lack of macros (other than builtin forms), and started over from scratch
to do something that provides macros and Common Lisp-like "declare". It's
got a smaller core than Schlep, but is more easily extensible and gives
you access to whatever compile-time Lisp or Scheme you have.

Yes, I'll make what I've done available "soon" (so don't bother asking),
but after looking at Schlep and C & X library interface stub generators
for several Scheme implemenations, as well as what I did, I'm firmly
convinced at this point that this is a case where "re-inventing the wheel"
is the *right* thing to do!! That is, the notion of coding in Lisp or Scheme
to get access to the compile-time facilities (macros, I/O, whatever) but
writing out the target code in language "Z" (or "Z", "Y", & "X", if you
have to keep multiple pieces in sync) is truly a "pattern" (in the Gabriel
sense more than the Gang of Four style) that is best employed by bending &
shaping it to your own needs, not something that should be codified in any
kind of one-size-fits-all "product/library/class".


Rob Warnock, 8L-846
Applied Networking
Silicon Graphics, Inc.		Phone: 650-933-1673
1600 Amphitheatre Pkwy.		FAX: 650-933-0511
Mountain View, CA  94043	PP-ASEL-IA