[cfe-dev] libclang or libtooling for transpiler
Andrei Damian via cfe-dev
cfe-dev at lists.llvm.org
Sun Apr 28 10:57:41 PDT 2019
Hello. First time here, no tomatoes please.
Long story short, I want to attempt to make a cpp to rust transpiler. I
know it’s a very big task with a lot of work, but let’s ignore that for a
Like any sane person who doesn’t want to parse cpp himself (or any text
format for that matter), I’m counting on clang to be able to give me enough
information (the whole AST?) so that I’d be able to translate it.
>From what I can see my options are the following:
1. libtooling, which from what I understand can do „everything”, but is
2. libclang, which is a C interface to the AST. So basically a stable C API
I would just go with libtooling to be safe in a normal circumstance, but I
was really hoping that I could make the transpiler in rust, and using
libtooling in this case would be problematic as its API is CPP and I would
have to make bindings to rust for everything.
So, from what I can see, my options here are:
1. libtooling + cpp, not ideal because I was hoping I would be able
to do it in rust;
2. libclang + rust, would be great but I don’t know if it’ll be
3. libclang + rust + extensions, so basically I’d extend the libclang
API myself (somehow?) where I would need it;
4. libtooling + rust, hopefully not.
So, here’s the question(s): Will libclang suffice my need? Which option
would you consider is the best?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-dev