The \-RTL Translator Source Distribution

This implementation of the \-RTL translator is distributed ``as is,'' for experimental purposes only. If you can make it do something useful, we're both happy.

The translator is written in a combination of Icon and Standard ML. (Actually, the translator does not run any Icon code, but Icon is used to generate some of the ML code that makes up the translator.) To make things even more interesting, the source code is written in noweb. Finally, the translator uses special Standard ML of New Jersey features, especially the Compilation Manager.

A final note --- this distribution includes (and subsumes) the experimental ML version of the New Jersey Machine-Code Toolkit.


First, get and install the software tools you will need.
  1. Get and install Icon from the Icon Project (FAQ here) at the University of Arizona. You can get binaries for 386 DOS, Linux, SPARC SunOS, SPARC Solaris, 32-bit Windows, and other targets.
  2. Get and install the noweb literate-programming tool.
  3. Get and install Standard ML of New Jersey, version 110 or later.
Naturally, you will need the binaries for these things on your execution path.

The final preliminary is to download the \-RTL source package.

Building the tools and the \-RTL translator

Untar the translator source package, which will create an lrtl directory. Edit the shell script lrtl/install, setting the variables in the script according to the comments. Then run cd lrtl; ./install, which should
  1. Compile and install the tools needed to build the translator.
  2. Build sml-nw, a version of Standard ML of New Jersey that understands how to use these tools build the translator. If an error occurs during this step, see below.
  3. Compile the translator itself (the big step).
The installation script runs in about 6 minutes on a Pentium 200 with 128M of memory. Once it completes, you should have an executable lrtl on your path.

Potential errors building sml-nw

An error may occur when building sml-nw, because not all SML/NJ versions beyond 110 treat CM tools in the same way. If you are using an older version like 110.0.3, you will have to change tools/export.sml to conform. As distributed, the file contains the following binding:
	val runlex =
               ( { command = command, tool = "ML-Lex+" }  (* old style *)
               ; { mkCommand = fn () => command, tool = "ML-Lex+" }  (* new style *)
If the compiler complains, you can simply remove the line marked `new style'.

Using the translator

The installation process should put an executable lrtl in with the other SML executables. The translator has a plethora of options, but most can be ignored.

The \-RTL translator uses an experimental type-inference algorithm that can usually insert fetches automatically and decide how large a fetched value will be. The easiest way to control this feature is with explicit typecasts, e.g., $m[addr] : #16 bits. It may sometimes be more convenient to define a function to perform the cast; i.e., if function hword is \x.x:#16 bits, then hword $m[addr] is equivalent to $m[addr] : #16 bits.


Send all correspondence to