lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


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