[cfe-dev] cling

Axel Naumann Axel.Naumann at cern.ch
Mon Jul 25 13:33:21 PDT 2011


Hi Garrison,

On 07/25/2011 09:59 PM, Garrison Venn wrote:
> I think this is very cool!

Thanks :-)

> So how well will it scale? For example can we use it to run on/with LLVM/Clang
> source?

It scales like a traditional translation unit. I.e. I wouldn't #include
all of clang's sources but pull clang in through shared libraries and
headers. As the example I sent shows, cling can load and reference
shared libs.

Cheers, Axel.


> 
> On Jul 25, 2011, at 15:28, Axel Naumann wrote:
> 
>> Hi,
>>
>> As we announced before
>> <http://www.llvm.org/devmtg/2010-11/Naumann-Cling.pdf>, we (people from
>> CERN and Fermilab) are working on the C++ interpreter(*) cling
>> <http://cern.ch/cling> that's based on clang and llvm. This is in the
>> context of ROOT <http://root.cern.ch> and CINT
>> <http://root.cern.ch/cint>, our current C++ interpreter.
>>
>> We have gotten to a stage where we believe cling is actually useful: it
>> behaves like a regular interpreter!
>>
>> [cling]$ #include <cmath>
>> [cling]$ double x = std::sin(3.1)
>> (double) 4.158066e-02
>> [cling]$ .L libz
>> [cling]$ #include "zlib.h"
>> [cling]$ zlibVersion()
>> (const char * const) "1.2.3.4"
>>
>> or simply
>>
>> $ echo 'extern "C" const char* zlibVersion();
>> zlibVersion()' | cling -lz
>>
>> (const char * const) "1.2.3.4"
>>
>> and even
>>
>> $ cat t.cxx
>> #include "cling/Interpreter/Interpreter.h"
>> void t() {
>>   gCling->processLine("gCling->getVersion()");
>> }
>> $ cling
>> [cling]$ .x t.cxx
>> (const char * const) "$Id: Interpreter.cpp 40322 2011-07-21 14:20:14Z
>> axel $"
>>
>> We would like to know whether it's just us finding this spectacular :-)
>> or whether there is general interest. Our aim is to get it included in
>> the clang repository.
>>
>> For us, this is just the first step; we need to integrate it into the
>> rest of our software wildlife here at CERN, and we need to continue to
>> work on robustness and features, e.g. reloading of code. I.e. I expect
>> we will maintain and continue to develop it for years to come.
>>
>> Here is the code:
>> svn co http://root.cern.ch/svn/root/branches/dev/cling
>>
>> Let us know what you think!
>>
>> Best regards,
>> the cling team (Vassil, Philippe, Paul, Lukasz and Axel).
>>
>> (*) Yes, it's not an interpreter, it's really an incremental compiler
>> with an interactive shell with (eventually) features like automatic
>> library loading and late variable binding. But it smells like an
>> interpreter :-)
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
> 
> 




More information about the cfe-dev mailing list