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: Xavier Leroy <Xavier.Leroy@i...>
Subject: Re: [Caml-list] LLVM: A native-code compiler for MiniML in ~100LOC
> I went through the usual steps in trying this and was extremely
> impressed with the results. After only two days I was able to create
> an optimizing native-code compiler for a subset of CAML large enough
> to represent the following Fibonacci program:

Yes, LLVM is an impressive project and your example demonstrates that
LLVM is very well suited to run-time code generation.

However, I have a point of terminology to make: the language you
implemented is not what is normally called Mini-ML in the literature.

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.

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

- Xavier Leroy