OVERVIEW: llvm-min-caml is a compiler for a subset of the OCaml programming language that targets the LLVM intermediate representation. It builds directly on the work of Eijiro Sumii, Moe Masuko, Kenichi Asai, who built the min-caml compiler targeting SPARC, PowerPC, and x86 assembly. Their project (along with documentation) can be found at http://min-caml.sourceforge.net/index-e.html I added a new backend targeting LLVM. Since I have no intention of mantaining the other backends, I have removed them (along with all other supporting files) from my distribution. The current status is full support of all the features of the original min-caml compiler, as can be found in the above website. In particular, we perform full tail-call optimization. OTHER LLVM PORTS: There are at least two other LLVM ports of min-caml that can be found through Google, but both fail to correctly perform tail-call optimization in all cases. * https://github.com/mzp/min-caml * https://github.com/kmacy/llmincaml The second one (llmincaml) failed to produce any LLVM output in fact when I compiled it. But inspection of the source shows that it does not perform tail call optimization in the case of an 'If' in tail position. PREREQUISITES: * OCaml I have 4.00.0 in my machine, but it should work with previous versions as well. I will update this README once I find out about this. The OCaml distribution can be downloaded from http://caml.inria.fr * LLVM with Ocaml bindings I used LLVM version 3.1 but, again, it should work with earlier versions as well. I will update this README once I find out about this. In any case, installing this should be as easy as running opam install llvm BUILDING: If both the prerequisites are installed and configured correclty, then follow the steps to build the llvm-min-caml compiler. 1- Get the source from GitHub git clone https://github.com/nojb/llvm-min-caml.git 2- A directory named 'llvm-min-caml' will have been created. Move into it. cd llvm-min-caml 3- Build the sources. ocamlbuild main.native 4- Test the compiler. I will add a proper test suite in the future, but for now you can do the following to compile the test test/gcd.ml. ./main.native -iter 0 test/gcd (the flag -iter 0 disables all optimizations so that the output is easier to read.) This will create a file test/gcd.bc containing the LLVM bitcode. To actually see it, you can use the llvm-dis utility from the LLVM distribution. llvm-dis < test/gcd.bc COPYRIGHT: All the files are copyright 2005, 2006, 2007, 2008, 2013, Eijiro Sumii, Moe Masuko, Kenichi Asai, Nicolas Ojeda Bar, and distributed under the conditions stated in the file LICENCE. BUG REPORTS AND USER FEEDBACK: Please report bugs and any user feedback directly to me at no263@dpmms.cam.ac.uk. CHANGELOG FOR PRE-LLVM VERSIONS: [Update on July 24, 2012] - 32-bit x86 (with SSE2, that is, Pentium IV or later) is now supported (on Linux and Cygwin); execute ./to_x86 before make. [Updates on September 17, 2008] - PowerPC is now supported (in addition to SPARC), thanks to Ms. Masuko and Prof. Asai in Ochanomizu University. You _must_ execute either ./to_ppc or ./to_sparc _before_ make. - The register allocator now uses a simpler algorithm. It omits the backtracking (ToSpill and NoSpill) in previous versions.