parse C expression?

eliben eliben at gmail.com
Tue Dec 16 01:21:43 EST 2008


On Dec 16, 1:48 am, Torsten Mohr <tm... at s.netic.de> wrote:
> Hi,
>
> i found some examples when googling for the subject but nothing really
> matched.
>
> Is there a standard module available that lets me parse a syntax like "C"
> with numbers, operators, braces, variables and function calls?
>
> I'd like to use this to parse an own kind of configuration language
> and preferred would be just standard modules.  Is there something
> available that is maybe based on shlex?
>
> Thanks for any hints,
> Torsten.

Sorry for the "shameless plug", but pycparser (http://code.google.com/
p/pycparser/) is exactly what you're looking for. It's a complete,
pure-Python parser for ANSI C.

Eli




More information about the Python-list mailing list