Scheme Boston: March 2003 meeting

Notes by Ed Kademan <kademan@phz.com>

The March 2003 meeting of Scheme Boston took place at Northeastern University Monday night March 10, 2003. Approximately 20 people showed up to hear Dorai Sitaram give a talk about his scmxlate system for semiautomatically translating Scheme/Lisp programs from one dialect to another. (In what follows I will use phrases like "Scheme" and "Scheme dialects" for simplicity, but these are meant to include Common Lisp as well.)

The problem that scmxlate addresses arises from the fact that in practice Scheme is more like a family of languages than it is a single one. Dorai had written important programs in Scheme but found that other people had substantial problems with them because the particular versions of the language they used were different enough from his to prevent those programs from running. He remarked that there were four different options a developer could adopt in the face of this problem:

  1. Write in a particular dialect and let other people port. (This wasn't working.)
  2. Write to the standard and avoid dependencies. (This was impractical because the standard is so minimalist.)
  3. Use conditionals to isolate dialect-specific expressions. (This was unwieldy.)
  4. Write a program that---with help from dependency information in files---can translate programs written in one Scheme to another. (This is scmxlate.)
Scmxlate occupies a middle position between a totally general and automatic translater on the one hand and manual porting---option 1 above---on the other. The program knows a lot about specific dialects and how to transform a program written in one into the equivalent for another, but it cannot take some arbitrary, possibly large and involved application and---without any help whatsoever from the developer---rewrite it into any of the other dozen or so Scheme languages. There is some human effort required. But that unavoidable effort falls on the developer for the most part, ordinary users do not have to shoulder it. And in practice so far the burden has been relatively modest. Dorai admitted that his programs run in language environments that he has long since forgotten how to program in. He just writes in the particular one he knows best and lets scmxlate do the translating, using rules that he once had to take the time to specify but that he doesn't have to think about anymore.

In order to use an scmxlate-enabled package all an end user has to do is start up Scheme in that package's directory, load scmxlate, and then answer a very small number of questions---such as "What is your dialect?" and "What is your operating system?" Scmxlate takes the input files written in the developer's dialect and translates them into output files written in the user's dialect. They are now ready to run.

That translation was able to proceed because of a series of files that the developer added to his package. Two general files list the dialects supported and the source files that need translating. All the other scmxlate files are known as dialect and user configuration files and are specific to the source files. That is, a source file named "apple.scm" might have a corresponding dialect configuration file named "guile-apple" and a user configuration file named "scmxlate-apple.scm." These configuration files give more detailed information on how to transform the source. (Dialect configuration files direct the main work. User configuration files contain defaults for things like global variables that the end user may want to specify and that the developer cannot be expected to know.)

For the most part the contents of the configuration files get added to the beginning of the corresponding source file. Any user configuration content comes first followed by dialect configuration content. But there exist directives that override this order. These directives accomplish a host of other chores as well such as:

Dorai said that the output the system generates is not necessarily beautiful, especially when translating to Common Lisp, and that it might be awkward to try transforming packages that are written as something other than a series of top level forms. But scmxlate is a practical tool that he has been using extensively. It is available at http://www.ccs.neu.edu/~dorai/scmxlate/scmxlate.html.