C language processing.

Miki Tebeka miki.tebeka at zoran.com
Mon Aug 23 05:09:01 EDT 2004


Hello stephen,

> 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.)
There an ANSI C parser that comes with PLY (http://systems.cs.uchicago.edu/ply/).
There is also a mini_c compiler somewhere that is based on PLY.

HTH.
--
------------------------------------------------------------------------
Miki Tebeka <miki.tebeka at zoran.com>
http://tebeka.spymac.net
The only difference between children and adults is the price of the toys



More information about the Python-list mailing list