Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Language for LLVM-based compiler

I'm looking at doing some initial tests and experiments with a toy language and building an LLVM-based compiler to get some benchmarkable results.

I realize that C++ is LLVM's "native" and best-supported language, but I really don't want to use C or C++. So I'm looking for a higher-level language that has stable and established support for working with the LLVM API.

My initial work with the Python LLVM library was a bit of a disappointment as the project seems to have been abandoned, though I hear promising news about PyPy integrating LLVM support into their framework, but I'd like to know what people's experience is before sinking a lot of time into any given route.

So my question is, have any of you had a positive experience working with LLVM using a higher-level language and/or framework? And if so, which? Or are there any that you would say to avoid?

like image 613
tylerl Avatar asked Oct 27 '11 23:10

tylerl


1 Answers

A subset of LLVM API is exposed via plain C wrappers. It is sufficient for code generation, and can be used from practically any high level language. There are OCaml bindings available out of the box (see this tutorial), and the Haskell bindings are quite mature as well (e.g., GHC itself can compile via LLVM). I've used LLVM from .NET-based languages too, without any bindings (just P/Invoke wrappers auto-generated from the headers).

like image 117
SK-logic Avatar answered Oct 23 '22 05:10

SK-logic