C language processing.

Eugene Oden goden at simplified.com
Sat Aug 21 11:51:40 EDT 2004


stephen henry wrote:

> Hi all,
> 
> I'm looking for a python module that would allow me to take an input
> file written in 'c' and modify the contents to allow me to, for
> example, add arguments to functions, insert macros at specific
> locations etc. I have no formal education in computer science , but,
> what I believe I'm looking for is somesort of parser (or lexer?).
> 
> So far, I found a bunch of pasers (SimpleParse and SPARK) but these
> seem to be quite generic -non-language specifc. I was hoping that the
> 'c' langauge was sufficiently well known to be supported natively,
> meaning that I would't need to enter the grammar rules into the
> parser.
> 
> Does anybody know of a way of doing this in python? (Or, for that
> matter, with Perl, as I would be learning either language to carry
> this out.)
> 
> Stephen Henry


i've had some luck using pybison (http://www.freenet.org.nz/python/pybison/)
using a freely available c grammar which is now included in the pybison
distribution.  it'll do the work of building a parse tree but you'll have
to take it from there.

later,

gene



More information about the Python-list mailing list