Version française
Home     About     Download     Resources     Contact us    
Browse thread
LLVM: A native-code compiler for MiniML in ~100LOC
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jon Harrop <jon@f...>
Subject: Re: [Caml-list] LLVM: A native-code compiler for MiniML in ~100LOC
On Sunday 02 December 2007 10:00, Xavier Leroy wrote:
> Your language has first-order, second-class functions, while Mini-ML
> has higher-order, first-class functions.  A runtime code generator for
> Mini-ML would be significantly more complex, since it has to deal with
> first-class functions either through closure conversion or
> defunctionalization, meaning in both cases dynamic allocation and
> garbage collection.

Yes, it was a little cheeky of me to call it MiniML. Adding first-class 
functions turned out to be trivial but making them higher-order will take 
more work.

I would like to build a new language implementation that draws mostly upon 
OCaml and F#. In particular, I'd like to augment OCaml with run-time types, 
something akin to type classes, operator overloading, high-performance 
numerics (built-in types for complex numbers and low-dimensional vectors and 
matrices, and 32-bit floats as a storage format) and a commerce-friendly 
intermediate representation.

Although I would like to build a platform suitable for commercial 
applications, I would like the whole thing to be open source and other 
contributions and ideas are most welcome!

There are some important design decisions to make first so I've got a lot of 
benchmarking to do before I'll start implementing any production-quality 
code.

> Which brings us back to Basile's original question about LLVM and the
> Caml garbage collector.  The following page suggests that they can
> already work together:
>
>         http://llvm.org/docs/GarbageCollection.html

To the best of my knowledge there are no working demos of any GCs using LLVM's 
API for this. Chris Lattner (the lead developer of LLVM) did implement a CLR 
on top of LLVM but the results are owned by Microsoft. He assures me that it 
is perfectly feasible and, I believe, Gordon Henriksen already has something 
working and it is in the pipeline but not yet in SVN LLVM.

They were only recently discussing whether or not an external front-end is 
even theoretically capable of generating OCaml-friendly native-code in order 
to reuse OCaml's GC.

Still, LLVM is an awesome project and, once someone makes the breakthough of a 
first working tutorial GC on it, I think it will snowball into a great 
alternative to Mono for creating new languages.

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/products/?e