Valery A.Khamenya
2003-Sep-06 16:13 UTC
[LLVMdev] languages, semantic trees, LLVM interfaces
Hello Vikram, Saturday, September 6, 2003, 9:10:45 PM, you wrote: VSA> For any language with relatively sophisticated syntax and semantic VSA> rules, you will probably need a higher-level representation like an VSA> Abstract Syntax Tree in order to do type-checking and other kinds of VSA> checking. OK, concerning AST -- I see. Thank you. 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? Kind regards, -- Valery A.Khamenya mailto:khamenya at mail.ru Local Time: 22:59
> 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?Valery, This is a good question and I don't think we have a good answer yet. We are already facing this issue for JVM and OCAML front-ends which we hope to develop in the next few months. If we have a good solution, we'll definitely let this list know. --Vikram --------------------------------------------------------------------- VIKRAM S. ADVE Assistant Professor E-MAIL: vadve at cs.uiuc.edu Department of Computer Science PHONE: (217) 244-2016 Univ. of Illinois at Urbana-Champaign FAX: (217) 244-6869 1304 W. Springfield Ave. http://www.cs.uiuc.edu/~vadve Urbana IL 61801-2987. http://llvm.cs.uiuc.edu/ ---------------------------------------------------------------------
> > 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/