[cfe-dev] libclang or libtooling for transpiler
Ilya Biryukov via cfe-dev
cfe-dev at lists.llvm.org
Mon Apr 29 00:07:36 PDT 2019
>From my experience, the API for traversing ASTs in libclang is pretty
limited. It might suffice for implementing syntax highlighting or
cross-references, but I'd expect to hit its limitations pretty quickly for
The C++ API for AST traversal is actually stable in practice (it does not
promise a stable *ABI*, but you don't need that if you implement a C++
I would highly advise to go with the C++ APIs.
On Sun, Apr 28, 2019 at 7:58 PM Andrei Damian via cfe-dev <
cfe-dev at lists.llvm.org> wrote:
> 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
> somewhat unstable;
> 2. libclang, which is a C interface to the AST. So basically a stable C
> API to libtooling.
> 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?
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-dev