[cfe-dev] libclang or libtooling for transpiler
Brian Cain via cfe-dev
cfe-dev at lists.llvm.org
Sun Jun 2 16:16:23 PDT 2019
IIRC c2rust does something like this, have you already looked at that
project for inspiration?
http://llvm.org/devmtg/2018-10/talk-abstracts.html#lt5
https://github.com/immunant/c2rust
On Sun, Apr 28, 2019, 12: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
> moment.
>
> 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
> enough;
>
> 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?
>
> Thanks,
>
> Andrei.
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20190602/f64cf737/attachment.html>
More information about the cfe-dev
mailing list