[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] luaclang - a Lua binding to the Clang API to parse C/C++ files
- From: Graham Wakefield <wakefield@...>
- Date: Thu, 12 Jul 2012 22:26:02 -0700
Nice. Did you know about our Lua/Clang binding?
https://github.com/grrrwaaa/luaclang
Different features/motivations of course; we've been concentrating on using it for the JIT compilation of C++ code, and recently I've been playing with the C-binding to LLVM via LuaJIT's FFI. An FFI-to-clang-c is in the works.
Perhaps there's an opportunity to merge efforts?
On Jul 12, 2012, at 2:55 AM, Michal Kottman wrote:
> Hi list,
>
> being a little frustrated with the inability to fix cpptoxml used in
> lqt to parse Qt headers, and seeing some amazing videos about the
> Clang compiler and its API, I decided to write a binding to libclang
> [1] - luaclang [2].
>
> luaclang is a Lua API over libclang (not all functionality provided,
> but most), which allows you to traverse the AST, gather classes,
> methods, access type information, etc. Using some C++ annotation magic
> it is even able to correctly determine Qt signals and slots. It is
> able to process the entire Qt framework and gather info for all
> classes, methods and arguments, which I want to use to make lqt better
> and future-proof.
>
> A sample file cindex.lua is provided, which takes in parameters as you
> would pass to a compiler to compile a single file, and it produces a
> SQLite database which you can query. I used it to query libclang
> itself to see if there are any important functions I missed :)
>
> I hope this tool will be useful for binding-generator writers, as you
> no longer have to parse headers manually and/or parse documentation,
> when you have the power of a robust C/C++ parser available in Lua :)
>
> [1] http://clang.llvm.org/doxygen/group__CINDEX.html
> [2] https://github.com/mkottman/luaclang
>