lua-users home
lua-l archive

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


On Saturday 14, Graham Wakefield wrote:
> Great stuff.
> 
> I'd definitely like to see a full binding to Clang/LLVM C-APIs in Lua; I
> think pooling what we have goes a long way already. I'd also like there to
> be both pure Lua and LuaJIT FFI binding alternatives, hopefully this can
> be done with near-identical syntax. It's also quite feasible that the
> Clang parser can generate the bindings to Clang, in a kind of
> bootstrapping way... did you try running luaclang-parser over the
> LLVM/Clang headers themselves?

At the end of last month I had thrown together an FFI binding [1] for Clang's 
CIndex interface with the plan of using it to bootstrap a full binding to it.  
I now wished I had push it out sooner for others to use.

I would like to use Clang's CIndex interface as a front-end to my 
LuaNativeObject [2] bindings generator, to try to simplify the bindings 
definition.

The project also include the start of a C++ to C bindings generator [3].  And 
a generic C++ parser [4] uses the CIndex interface to parse the 
class/method/member definitions from C++ code, which is used by the generator 
to create wrapper C functions for each of the public C++ methods.  Right now 
it can generate valid code that compiles, but I haven't used it for anything 
yet.  It should be easy to update the generator to also generate FFI bindings 
to the wrapped C++ interface.

1. https://github.com/Neopallium/lua-clang-cindex
2. https://github.com/Neopallium/LuaNativeObjects
3. https://github.com/Neopallium/lua-clang-
cindex/blob/master/cpp_to_c_generator.lua
4. https://github.com/Neopallium/lua-clang-cindex/blob/master/cpp_parser.lua

-- 
Robert G. Jakabosky