scheme shell
about
download
support
resources
docu
links
 
scsh.net

From: Martin Gasbichler <gasbichl@informatik.uni-tuebingen.de>
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: <vya1yfzeumr.fsf@aubisque.informatik.uni-tuebingen.de>

>>>>> "Michal" == Michal Maruška <mmc@maruska.dyndns.org> writes:

Michal> Martin Gasbichler <gasbichl@informatik.uni-tuebingen.de> writes:

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

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

:-)))

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

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
ftp://ftp.nj.nec.com/pub/kelsey/prescheme.ps.gz 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 autogen.sh:

#! /bin/sh

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

autoheader
autoconf

# We need a Makefile for the rest:
./configure

# 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
# BUILD_RUNNABLE:

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.

--
Martin

Up