A compact Core Standard ML implementation

Peter Sestoft (sestoft@id.dtu.dk)
Tue, 13 Sep 1994 16:00:00 GMT

Standard ML is a strict functional language, widely used in research
and increasingly used in teaching, sometimes even as a first language.

Moscow SML provides a light-weight implementation of the Standard ML
Core language, suitable for use on small computers.

Moscow SML is particularly suitable for teaching and experimentation,
where fast compilation and modest storage consumption are more
important than fast program execution.

* Thanks to the efficient run-time system of Caml Light, Moscow SML
compiles fast and uses little memory. Typically it uses 5-10 times
less memory than SML/NJ and 2-3 times less than Edinburgh ML. Yet the
bytecode is only 3 to 12 times slower than SML/NJ 0.93 compiled native
code (fast on PCs, slower on RISCs).

* Thanks to guidance from the ML Kit model implementation, Moscow SML
is true to the Definition of Standard ML (Milner,Tofte,Harper 1990).

In principle, it can be compiled on any platform supported by Caml
Light. So far we have tried Intel386-based PCs running DOS, Windows,
OS/2 or Linux, DEC MIPS running Ultrix, and DEC Alpha running OSF/1.

SYSTEM REQUIREMENTS UNDER LINUX

Moscow SML was compiled under Linux 1.0 with gcc 2.4.5, and requires
2 MB of RAM or more. The installation requires 250 KB disk space.

LIMITATIONS

The current version 1.00 of Moscow SML
* implements the entire Standard ML Core language
* does not implement modules (signatures, structures, functors)
* does not raise arithmetic exceptions properly

COMPILATION SPEED AND MEMORY CONSUMPTION --- AN EXAMPLE

We measured the time and space consumption for compiling a 780-line
Core ML version of Larry Paulson's proofchecker "Hal" (see Paulson: ML
for the Working Programmer, Cambridge University Press, 1992).

System SZ RSS TIME
----------------------------------
SML/NJ 0.93 8360 7284 0:40 ) DECstation 5200 (MIPS)
Edinburgh ML 4.1 2528 2020 0:19 ) with 48 MB RAM
Moscow SML 1.00 876 796 0:10 ) running Ultrix

SML/NJ 0.93 10265 7272 1:01 ) 486DX/33 with 16 MB RAM
Moscow SML 1.00 813 836 0:11 ) running Linux 1.0

SZ is the amount of virtual memory in KB, RSS is the amount of in-core
memory in KB, TIME is the cpu+system time spent on compilation. Note
that the figures indicate *compilation* time, not the speed of the
compiled programs. However, the bytecode of Caml Light, and hence of
Moscow SML, appears to make good use of the Intel processors (which
have no alignment constraints).

MOSCOW SML HAS BEEN TESTED

A testsuite for the Core static semantics found three errors in a
preliminary version of Moscow SML. These have been corrected in
version 1.00. The testsuite was developed systematically (from the
Definition of Standard ML) by Sten Schmidt and Michael Vium in a
student project at the Technical University of Denmark. The test
suite is available as ftp.id.dtu.dk:pub/sestoft/coresmltest.tar.gz.

Running the 177 Core-related test cases from the SML/NJ test suite
found three more errors; these have been corrected as well.

PLANS

It is the intention, sooner or later,

* to add a simple separate compilation system a` la Caml Light (sooner);
* to implement the Standard ML module language (later).

AUTHOR AND CREDITS

Moscow SML was written by
Sergei Romanenko (sergei-romanenko@refal.msk.su)
Keldysh Institute of Applied Mathematics, Russian Academy of Sciences
Miusskaya Pl. 4, 125047 Moscow, Russia.

Scientific and practical assistance was provided by
Peter Sestoft (sestoft@dina.kvl.dk), Technical University of Denmark.

Moscow SML is based on, and would not exist without:
* the CAML Light 0.6 implementation by Xavier Leroy and Damien Doligez
(INRIA, Rocquencourt, France);
* the ML Kit by Lars Birkedal, Nick Rothwell, Mads Tofte and David Turner
(Copenhagen University, Denmark, and Edinburgh University, Scotland);
* djgpp and the go32 DOS extender by D.J. Delorie (Rochester, NH, USA).

HOW TO OBTAIN MOSCOW SML

* The Linux executables are in
dina.kvl.dk:pub/Peter.Sestoft/mosml/linux-mos1bin.tar.gz
* The DOS/Windows/OS2 executables are in
dina.kvl.dk:pub/Peter.Sestoft/mosml/mos1bin.zip
* The source files are in
dina.kvl.dk:pub/Peter.Sestoft/mosml/mos1src.tar.gz

You will need Caml Light 0.6 and gcc to compile Moscow SML for Unix.

You will need Caml Light 0.6, djgpp, perl, and Borland C++ version 2.0
(or later) to recompile Moscow SML for DOS:
* Caml Light can be obtained from ftp.inria.fr:lang/caml-light/
* Djgpp and go32 can be obtained from oak.oakland.edu:/pub/msdos/djgpp/

-- 
Peter Sestoft   *   sestoft@id.dtu.dk   *   Department of Computer Science
Technical University of Denmark, Building 344      DK-2800 Lyngby, Denmark
Tel: +45 45 93 33 32 * Direct: +45 45 93 12 22/3749 * Fax: +45 42 88 45 30

--
Send submissions for comp.os.linux.announce to: linux-announce@tc.cornell.edu
Be sure to include Keywords: and a short description of your software.