[LLVMdev] languages, semantic trees, LLVM interfaces
Chris Lattner
sabre at nondot.org
Tue Sep 9 10:00:03 PDT 2003
> > VSA> For OCAML, for example, the front-end is quite sophisticated
> > VSA> and complex and the LLVM representation would not be suitable for
> > VSA> supporting all the checking and translation.
> >
> > But I have just meant ocamlyacc, i.e. ocaml clone of the yacc.
> > And here my question was: what kind of interface is expected to use
> > from within ocml, CommonLisp implementations, Haskel and other nice
> > language implementations? What is the expected way of interfacing
> > LLVM for those non-C language implementations? shared libraries with
> > plain C-interface or what?
There are currently two options:
1. If you can, linking your front-end to the LLVM libraries and using the
C++ API is certainly the simplest and most stable way to do it.
2. Otherwise, you can build some form of LLVM representation in your
front-end, then output LLVM "assembly" language. This is not as nice
as option #1, because you have to reinvent a new representation for
LLVM, which, although not difficult, seems like a waste of time. :)
FWIW, the C/C++ front-end currently uses option #2. The reason for this
is that the C/C++ front-end is built into the GCC infrastructure, which is
not very friendly to C++. Also, this prevents the LLVM infrastructure
itself from having to be GPL'd.
-Chris
--
http://llvm.cs.uiuc.edu/
http://www.nondot.org/~sabre/Projects/
More information about the llvm-dev
mailing list