Home

Research

Compilers related to SML.NET

MLj was a predecessor of SML.NET that targeted the Java Virtual Machine.

Publications related to SML.NET

Shrinking Reductions in SML.NET
Nick Benton, Andrew Kennedy, Sam Lindley and Claudio Russo. In Proceedings of the 16th International Workshop on Implementation and Application of Functional Languages (IFL '04). September 2004. Springer Lecture Notes in Computer Science, 2005 (to appear). A preliminary version appeared in the Draft Proceedings of IFL'04, Technical Report 0408, Institute of Computer Science and Applied Mathematics, University of Kiel.

One performance-critical phase in the SML.NET compiler involves rewriting intermediate terms to monadic normal form and performing non-duplicating β-reductions. We present an imperative algorithm for this simplification phase, working with a mutable, pointer-based term representation, which significantly outperforms our existing functional algorithm. This is the first implementation and evaluation of a linear-time rewriting algorithm proposed by Appel and Jim.

Adventures in Interoperability: The SML.NET Experience.
Nick Benton, Andrew Kennedy and Claudio Russo. 6th ACM-SIGPLAN International Conference on Principles and Practice of Declarative Programming (PPDP), Verona, Italy, August 2004.

SML.NET is a compiler for Standard ML that targets the Common Language Runtime and is integrated into the Visual Studio development environment. It supports easy interoperability with other .NET languages via a number of language extensions, which go considerably beyond those of our earlier compiler, MLj.

This paper describes the new language extensions and the features of the Visual Studio plugin, including syntax highlighting, Intellisense, continuous type inference and debugger support. We discuss our experiences using SML.NET to write SML programs that interoperate with other .NET languages, libraries and frameworks. Examples include the Visual Studio plugin itself (written in SML.NET, using .NET's COM interop features to integrate in a C++ application) and writing ASP.NET and Pocket PC applications in SML.

Exceptional Syntax
Nick Benton and Andrew Kennedy. In Journal of Functional Programming, 11(4): 395-410, July 2001.

From the points of view of programming pragmatics, rewriting and operational semantics, the syntactic construct used for exception handling in ML-like programming languages, and in much theoretical work on exceptions, has subtly undesirable features. We propose and discuss a more well-behaved construct.

Monads, Effects and Transformations
Nick Benton and Andrew Kennedy. In The Third International Workshop on Higher Order Operational Techniques in Semantics (HOOTS), Paris, France, September 1999.
Published as Volume 26 in Electronic Notes in Theoretical Computer Science, Elsevier.

We define a typed compiler intermediate language, MIL-lite, which incorporates computational types refined with effect information. We characterise MIL-lite observational congruence by using Howe's method to prove a ciu theorem for the language in terms of a termination predicate defined directly on the term. We then define a logical predicate which captures an observable version of
the intended meaning of each of our effect annotations. Having proved the fundamental theorem for this predicate, we use it with the ciu theorem to validate a number of effect-based transformations performed by the MLj compiler for Standard ML.

Interlanguage Working Without Tears: Blending SML with Java
Nick Benton and Andrew Kennedy. In Proceedings of the 4th ACM SIGPLAN International Conference on Functional Programming, Paris, France, September 1999.

A good foreign-language interface is crucial for the success of any modern programming language implementation. Although all serious compilers for functional languages have some facility for interlanguage working, these are often limited and awkward to use.

This article describes the features for bidirectional interlanguage working with Java that are built into the latest version of the MLj compiler. Because the MLj foreign interface is to another high-level typed language which shares a garbage collector with compiled ML code, and because we are willing to extend the ML language, we are able to provide unusually powerful, safe and easy to use interlanguage working features. Indeed, rather then being a traditional foreign interface, our language extensions are more a partial integration of Java features into SML.

We describe this integration of Standard ML and Java, first informally with example program fragments, and then formally in the notation used by The Definition of Standard ML.

Compiling Standard ML to Java Bytecodes
Nick Benton, Andrew Kennedy, and George Russell. In Proceedings of the 3rd ACM SIGPLAN International Conference on Functional Programming, Baltimore, Maryland, USA, September 1998.

MLJ compiles SML'97 into verifier-compliant Java bytecodes. Its features include type-checked interlanguage working extensions which allow ML and Java code to call each other, automatic recompilation management, compact compiled code and runtime performance which, using a `just in time' compiling Java virtual machine, usually exceeds that of existing specialised bytecode interpreters for ML. Notable features of the compiler itself include whole-program optimisation based on rewriting, compilation of polymorphism by specialisation, a novel monadic intermediate language which expresses effect information in the type system and some interesting data representation choices.

Related Work

Don Syme's F# compiler.

Both MLj and SML.NET were developed using the Standard ML of New Jersey compiler.