Implementation of a C pre-processor in Python or JavaScript?
Posted
by
grrussel
on Stack Overflow
See other posts from Stack Overflow
or by grrussel
Published on 2010-12-03T23:12:56Z
Indexed on
2011/01/29
23:26 UTC
Read the original article
Hit count: 209
Is there a known implementation of the C pre-processor tool implemented either in Python or JavaScript? I am looking for a way to robustly pre-process C (and C like) source code and want to be able to process, for example, conditional compilation and macros without invoking an external CPP tool or native code library. Another potential use case is pre-processing within a web application, within the web browser.
So far, I have found implementations in Java, Perl, and of course, C and C again. It may be plausible to use one of the C to JavaScript compilers now becoming available.
The PLY (Python Lex and Yacc) tools include a cpp implemented in Python.
© Stack Overflow or respective owner