Wednesday, October 1, 2014

Parsing C code from Python with PyLangParser

Recently I have been working on a Python tool for static analysis of source code, for programs based on GLib/GStreamer, which takes advantage of the GObject-Introspection annotations built on top of GTK-Doc comment blocks.
The tool discovers potential memory leaks. It is in an early, still unstable phase but I hope that I will manage to make it available sometime in the near future.

It is based on a small Python tool that I wrote a while ago for parsing formal languages. The tool is called pylangparser and is fairly simple to use and does not depend on any external libraries. Grammars are defined inside the source code file. There are also some example scripts which show how it can be used for parsing and analyzing C source code. You may want to take a look at it, it is available on GitHub:

PyLangParser

No comments:

Post a Comment