Implementation of a C pre-processor in Python or JavaScript?
- by grrussel
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.