The commonly available software metrics-extraction tools for C/C++ depend on commercial preprocessors to preprocess the source file before being input into the analyzers. The following paper introduces a Java compiler generator called JavaCC and the application of the generator to develop a Java-based preprocessor for C/C++. Some technical features to the development of preprocessor are also mentioned, such as (1) handling of rescanning in preprocessing with LL(k) parsers, (2) managing conditional compiling with the state-based features of the lexical analyzer in JavaCC, and (3) resolving macro replacement and expansion with parsers.
/lp/association-for-computing-machinery/the-application-of-javacc-to-develop-a-c-c-preprocessor-I3LL05d2j0