we want to implement a C++ interpreter using LLVM and clang, to replace
our existing one <http://root.cern.ch/drupal/content/cint> that is used
as part of a data handling and analysis environment
<http://root.cern.ch>. We plan to keep the set of features that our
current interpreter offers, e.g. calls into and out of libraries,
dynamic scoping, unloading of code, and a prompt. I will (hopefully
present the plans at the upcoming developers' meeting in October. I am
aware of at least one other effort pushing into the same direction;
maybe there are more people interested in getting this done?
If you are, please contact me until Wednesday, Sept 2nd. My colleagues
and I would like to meet you informally in the morning of Saturday, Oct
3, right after the dev meeting, if possible somewhere close to the Apple
campus. We'd like to hear what your goals are, whether we can combine
our work, and discuss experiences, problems and possible solutions.
Building a C++ interpreter involves a substantial amount of work beyond building a working C++ frontend and code generator (translation to LLVM IR). I think Axel was referring to the work on the interpreter itself, which would build on top of the work-in-progress C++ support in Clang.
Clang is meant to be flexible enough to be used as the basis for a C++ interpreter. However, there will probably be a bit of work to do in Clang to make this happen, e.g., by providing clean APIs for an interpreter to call into Clang's parser to parse a new expression/statement/function.
Speaking of those APIs, I guess if you do have something of the sort,
it may be easy to evaluate expressions and understanding the structure
of a program on a debugger.
If you manage to parse dwarf information on the same structure as
clang (or the interpreter) does with code, one can later list the
members of a class, print their values etc.
Clang is meant to be flexible enough to be used as the basis for a C++
interpreter. However, there will probably be a bit of work to do in Clang to
make this happen, e.g., by providing clean APIs for an interpreter to call
into Clang's parser to parse a new expression/statement/function.
Speaking of those APIs, I guess if you do have something of the sort,
it may be easy to evaluate expressions and understanding the structure
of a program on a debugger.
Correct. As a matter of fact we use the current interpreter's knowledge also for introspection and serialization.
If you manage to parse dwarf information on the same structure as
clang (or the interpreter) does with code, one can later list the
members of a class, print their values etc.
Right, having a working interactive C++ interpreter would also help for a debugger, as you said assuming that the symbols "are there". Function calls will be possible, too; you could also create objects in the interpreter stack and evaluate them.