scheme shell

From: Martin Gasbichler <>
Newsgroups: comp.lang.scheme.scsh
Subject: Bootstraping Scheme 48
  (Was: problems w/ configure(.in) from CVS,  now only w/ Makefile)
Date: 05 Feb 2002 17:55:08 +0100
Organization: Zentrum fuer Datenverarbeitung
Message-ID: <>

>>>>> "Michal" == Michal Maruška <> writes:

Michal> Martin Gasbichler <> writes:

>> The CVS_READEME explains what to do here: Get Scheme 48, version 0.53
>> , install it and let's variable BUILD_RUNNABLE point to
>> it. Now rerun ./autogen.

Michal> thanks. May i ask you, what is going on in ./ ?


First a few words about the architecture of Scheme 48 (There is almost
nothing specific to Scsh going on in

Scheme 48 uses a virtual machine to interpret bytecode. The VM is
written in a Scheme dialect called PreScheme which is compiled to C;
the PreScheme compiler is written in full Scheme (See for details about
PreScheme). The bytecode compiler is also written in full Scheme and
part of the image the VM is started up with. So the goal of the whole
process here is to generate the VM and an image for it.

Now let's walk through

#! /bin/sh

# These steps are standard: they produce the ./configure script:


# We need a Makefile for the rest:

# In earlier versions of scsh, a compiler called "cig" used to produce
# C files from Scheme files, but this is gone, so this step is
# superfluous:

touch scsh/*.c

# build/filenames.scm generates build/filenames.make which in turn
# list all the files that are necessary to bootstrap the bytecode
# compiler. We touch build/filenames.scm here to force
# build/filenames.make to be remade. Deleting build/filenames.make it
# is not an option as the Makefile includes build/filenames.make:

touch build/filenames.scm

# Remove (almost) all auto-generated files:
rm -f scheme48.image cig/cig.image scsh/scsh.image
rm -f build/linker.image build/initial.image
rm -f c/scheme48.h

# Remake buile/filenames.make using the existing Scheme 48

make build/filenames.make

# Build the virtual machine. The funny looking target will load the
# PreScheme compiler into the Scheme interpreter BUILD_RUNNABLE and
# compile the VM with it. This step will generate c/scheme48vm.c and
# c/scheme48heap.c

make i-know-what-i-am-doing

# This header file also needs to be remade to fit the VM just built:

make c/scheme48.h

# Now that we have our VM we need an image to start it. First we load
# the bytecode compiler from the sources into an existing Scheme 48
# interpreter (again we take BUILD_RUNNABLE) and dump the image
# build/linker.image:

make linker

# Now we use BUILD_RUNNABLE together we the bytecode compiler in
# linker.image to generate build/initial.image. This image will be
# suitable for *our* VM and contain the bytecode compiler so we can
# compile scheme48.image and scsh/scsh.image later:

make build/initial.image

# Finally we clean up:

make distclean

When later the user types "make" we first compile our VM using gcc
start it with build/initial.image.