- Scheme 97.5%
- Shell 1.9%
- Emacs Lisp 0.6%
Pre-Scheme Workbench
This repository provides a workspace and tools for hacking on the Pre-Scheme compiler codebase as part of the Pre-Scheme Restoration project. It consists of the following:
- manifest.scm: A guix manifest which sets up the necessary external tools, including applying patches to some of those.
- .envrc: A direnv script which prepares the shell environment;
applying the guix manifest, adding local tools to
PATH, and setting useful variables likePRESCHEME_DIR. - bin/run-scsh: A shell wrapper for scsh which pre-loads the scsh library described below, and uses rlwrap to provide a convenient command-line experience with history and tab-completion.
- scsh-lib/: A set of scsh modules providing a variety of useful functionality for this project, including reflection tools for digging through Scheme 48 modules and the Pre-Scheme compiler codebase.
- scripts/: A collection of scripts for performing various tasks related to this project, such as generating dependency graphs & library definitions for the Pre-Scheme compiler.
- patches/: A set of patches for external tools which are necessary for the correct functioning of this repository, automatically applied by the guix manifest.
- elisp/: Useful Emacs extensions for working with this repository, currently just scsh-mode which fixes highlighting issues when working with Scsh.
- share/: Shared data files, currently used for identifier completion lists.
- prescheme/: A git submodule containing a checkout of the Pre-Scheme compiler codebase, which is assumed to be the target of the various scripts and utilities.
- scheme-index/: A git submodule containing a checkout of the Scheme Index codebase, which contains R5/6/7RS and SRFI procedure metadata.
- scheme48/: A git submodule containing a checkout of the Scheme 48 source code, which contains the Pre-Scheme implementation of the Scheme 48 virtual machine and garbage collectors.
- s48-r7rs/: A git submodule containing a checkout of the Scheme 48 R7RS compatibility library, which can be used to load the R7RS port of the Pre-Scheme compiler into Scheme 48.
Additional READMEs can be found in the subdirectories, providing more detailed descriptions of their contents.
Using Scsh in (current-year)
The choice of scsh as the platform for these tools might seem anachronistic; these days pragmatic Schemers tend to use one of the many other excellent Scheme implementations. For the purposes of this project, scsh offers a "killer feature": the ability to load and run the Pre-Scheme compiler in its original form. This enables introspection of the codebase which is essential for taking a systematic approach to the porting effort.
The run-scsh wrapper is the main way to work with these tools. When
run from a terminal, it loads a REPL with an extended scsh environment
and access to the utility libraries. During development, scripts can be
loaded into the REPL with ,load path/to/script.scm which will make all
procedures (including main) available for interactive use.
If you're using Emacs, you might notice that some Scsh scripts
are incorrectly highlighted when using the | operator, due to an
incompatibility with R7RS identifier literal syntax. The provided
scsh-mode uses a modified syntax table which fixes this issue.
Using Guix (or not)
This repository relies on guix to set up the requisite development
environment, including patched versions of scheme48 and scsh. It
should be possible to reproduce this environment by applying patches and
building dependencies manually, but that use-case is not currently
supported.
Copying
This code is licensed under BSD-3-Clause, the same as Scheme 48, Scsh, and the Pre-Scheme compiler. See COPYING for details.