Team Gallium

Members
Overall Objectives
Scientific Foundations
Application Domains
Software
New Results
Contracts and Grants with Industry
Other Grants and Activities
Dissemination
Bibliography

Section: New Results

The Objective Caml system, tools, and extensions

The Objective Caml system

Participants : Damien Doligez, Alain Frisch, Jacques Garrigue [ U. Nagoya ] , Xavier Leroy, Maxence Guesdon, Luc Maranget [ project Moscova ] , Pierre Weis [ team AT-Roc ] .

This year, we released three versions of the Objective Caml system: 3.09.1, 3.09.2 and 3.09.3. These are bug-fix releases for version 3.09, which was released at the end of 2005. Damien Doligez acted as release manager for these three versions. The main novelty in these updates is a port to the recent, popular MacOS X/Intel platform. In addition, about 60 minor bugs were corrected.

CamlP4

Participants : Nicolas Pouillard, Michel Mauny.

Camlp4 is a source pre-processor for Objective Caml that enables programmers to define extensions to the Caml syntax (such as syntax macros and embedded languages), redefine the Caml syntax, pretty-print Caml programs, and program recursive-descent, dynamically-extensible parsers. For instance, the syntax of OCaml streams and recursive descent parsers is defined as a Camlp4 syntax extension. Camlp4 communicates with the OCaml compilers via pre-parsed abstract syntax trees. Originally developed by Daniel de Rauglaudre, Camlp4 has been maintained since 2003 by Michel Mauny, and is now developed by Nicolas Pouillard.

During his internship under Michel Mauny's supervision, Nicolas Pouillard designed and implemented a new architecture for the CamlP4 subsystem, aiming at facilitating its maintenance as well as simplifying the implementation of extensions. As a result, CamlP4 now features a simpler bootstrap mechanism, a more efficient generic lexical analyzer, more conventional pretty-printers, a better handling of source locations, and a more modular architecture. Nicolas Pouillard also added hooks for filters, allowing to insert arbitrary program transformations of OCaml parse trees before they are sent to the compiler, and redesigned the the quotation system to make it as extensible as the input language itself.

Automatic tools to orchestrate the compilation process

Participants : Nicolas Pouillard, Alain Frisch, Berke Durak.

The process of compiling a software project is sometimes tricky: one must usually respect some kind of dependency ordering between compilation units, and inferring the dependencies is not trivial (it can depend on some parts of the project being already built); some source files might be automatically generated (or preprocessed) from other files, sometimes by generators which are themselves part of the project; the rules defining how the project is built can themselves change frequently during development or depend on some properties of the environment. Developers also appreciate not having to recompile all the project when only a part has been changed (incremental recompilation). The standard compilation technology, based on the make tool, quickly shows its limits.

We have started to study and categorize the difficulties related to orchestrating the compilation process, with a special (but not exclusive) focus on Objective Caml projects, and to develop tools to experiment with new ideas, such as high-level descriptions of software projects or dynamic discovery of dependencies by analyzing how compilers interact with the file system. The final objective of this work is to produce robust tools to make it easier to develop and deploy complex OCaml software. We also expect this work to help us design guidelines for compiler makers. For instance, a light cooperation with the compiler is often enough to obtain precise dependency information, without the need of necessarily approximative and sometimes unsound external tools.

ReFLect over Ocaml

Participants : Virgile Prevosto, Nicolas Pouillard, Michel Mauny, Damien Doligez.

Virgile Prevosto (until May 2006), and Nicolas Pouillard (since July 2006), in collaboration with Damien Doligez and Michel Mauny, develop a new implementation of a functional programming language called ReFLect. This language is used at Intel Corporation to perform model-checking and circuit verification. ReFLect supports both lazy evaluation and imperative features, provides binary decision diagrams as a generalization of boolean values, and includes reflective aspects. This work, supported by a contract between INRIA and Intel, started in September 2005.

The main goal of the first twelve months was to provide a non-ambiguous specification of the semantics of the existing ReFLect interpreter from Intel Strategic Lab and to implement a compiler for the core language. Virgile Prevosto implemented a prototype compiler called CaFL (or ``ReFLect over OCaml'') that was demonstrated to Intel during the summer 2006. Nicolas Pouillard carried on Virgile's work from July 2006 and continued the development, generalizing the usage of AlphaCaml for managing the scope of identifiers and adapting CUDD, a free BDD package, to CaFL. Michel Mauny started to implement the ReFLect overloading machanism into CaFL.

Type-safety of unmarshaled OCaml values

Participants : Grégoire Henry [ PPS, U. Paris 7 ] , Michel Mauny, Emmanuel Chailloux [ PPS, U. Paris 7 and LIP6, U. Paris 6 ] .

Unmarshaling (reading OCaml values from disk files, for instance) is not a type-safe operation in the current OCaml implementation. Indeed, there is currently no way to provide an unmarshaling function with a polymorphic (parametric) type. Furthermore, marshaled values written to disk by OCaml do not carry type information. Generally, unmarshaling functions in staticallly typed programming languages have monomorphic types and return values containing explicit type information. Some form of dynamic type checking is then necessary, as a programming language construct, in order to recover a statically typed value from such an unmarshaled value.

Grégoire Henry and Michel Mauny devised an extension of ML-like languages where unmarshaling functions receive a representation of some type t as argument and return values of type t, or fail. This is obtained by extending the language with a predefined parameterized abstract type $ \alpha$ tyrepr whose values are representations of the current instance of the type parameter $ \alpha$ . These type representations are then passed at run-time to an algorithm able to test whether an unmarshaled value can be safely used with type t or not: a relatively simple task, except when parts of the value are polymorphic, shared or cyclic. Grégoire Henry and Michel Mauny formalized this algorithm, and proved its correctness and completeness. This result was presented at the JFLA 2006 conference [24] and a prototype implementation was released as a patch to the OCaml distribution.

This work provides safe unmarshaling of all kinds of OCaml values excepted those involving functions. The extension of this algorithm to functions is under consideration, and uses a new formalization using a presentation of type verification as collecting and solving constraints, following Pottier and Rémy's présentation of ML type inference [7] .

The Caml development environment

Participant : Maxence Guesdon.

Maxence Guesdon took part in the development of LablGtkSourceview, the OCaml bindings with the GtkSourceview library which provides Gtk text widgets with color highligthing.

Maxence Guesdon continues his work on Cameleon, the integrated development environment for Objective Caml described in section  5.8 . This year, Chamo was added to Cameleon. Chamo is a powerful source code editor based on LablGtkSourceview and offering complete customization possibilities using OCaml code, the same way as Emacs and Lisp.

Maxence Guesdon developed a graphical editor of OCamlyacc files based on Yacclib, the small library to parse and print OCamlyacc files. This editor is included in the Yacclib distribution.


previous
next

Logo Inria