Hacker News new | ask | show | jobs
by SloopJon 4578 days ago
Wow. Although I was vaguely aware that Clang is tool friendly, I had no idea about libclang, let alone its Python bindings. A search for "python clang module" turned up a mention of pycparser. Any idea how it compares? I guess its main advantage is that it's pure Python.
2 comments

Great introduction to libclang and cindex from Eli Bendersky:

http://eli.thegreenplace.net/2011/07/03/parsing-c-in-python-....

(another shameless plug: libclang bindings are also available for Julia)

I can't really compare, because I've personally never used pycparser. The nice thing about using libclang is that you're just using the same backend as the actual compiler and you can be sure that you're going to parse complex things correctly and reliably.