[cfe-dev] C++ Support

Philip Scott cfe at foo.me.uk
Thu Apr 23 14:05:15 PDT 2009


Hi all,

I have a bit of an project in mind to write a simple language for
dealing with a rather specific problem domain (high frequency time
series), but using the power of clang to make the language highly
interoperable with C++; e.g. my language's simplified classes will be
valid C++  classes, strings will be std::strings etc.. in order to allow
tricksy parts of a codebase to be written  easily in C++, while the
custom language would be a tool to create a tool for non-programmers to
quickly develop strategies and analyses.

I was thinking of hooking into the AST generation stage of clang,
parsing my language into the same AST that clang uses, and then
borrowing the rest of the compilation pipeline in order to JIT compile
the code and run it; does this sound at all feasable? I have made brief
examination of the clang code and it looks like this could work (great
code, by the way; it's like a soothing balm after the stuff I have to
deal with at work). I guess the things that could put a halt or the
breaks on the project are whether or not the code generated by clang is
interoperable with that which gcc belches out (same name mangling scheme
etc..) and the general state of c++ support.

I managed to get a few really basic programs compiled and running, but
as soon as I tried something a bit adventurous like #include<iostream>,
the world appeard to fall apart. Is this expected, or am I doing
something wrong? If need be I am happy to muck in to get this show on
the road; but just so I know roughly how far away are y'all from being
able to compile something like the standard library? (actually for my
purposes being able to parse the headers would be sufficient)

All the best,

Philip



More information about the cfe-dev mailing list