[cfe-dev] cling

Axel Naumann Axel.Naumann at cern.ch
Thu Jul 28 02:38:06 PDT 2011

Hi Daniel,

On 07/28/2011 01:49 AM, Daniel DeCovnick wrote:
> How does it compare to ccons (http://code.google.com/p/ccons/),

Both looked at one another, but both took different routes in the end;
they have different abilities and do things differently behind the scenes.

E.g. cling has a never-ending translation unit, while ccons (if I
remember correctly) tries to import previous declarations into new
translation units that it then links in. One of the many examples.

ccons seems to not support C++.

> and any chance we could get C and

Supporting C should be somewhere between trivial and easy.

> Objective-C/Objective-C++ support eventually?

We tried to not deliberately exclude it :-) My experience with
ObjectiveC/C++ is too limited to estimate how much work it would be.

Cheers, Axel.

> On Jul 25, 2011, at 12:28 PM, 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) ""
>> or simply
>> $ echo 'extern "C" const char* zlibVersion();
>> zlibVersion()' | cling -lz
>> (const char * const) ""
>> 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 <mailto:cfe-dev at cs.uiuc.edu>
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

More information about the cfe-dev mailing list