[cfe-dev] cling

Axel Naumann Axel.Naumann at cern.ch
Mon Jul 25 12:28:17 PDT 2011


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 :-)



More information about the cfe-dev mailing list