Yacfe (Yet Another C/C++ Front-End) is mainly an OCaml API to write
style-preserving source-to-source transformations such as refactorings
on C or C++ source code.
The goal of Yacfe is to parse the code as-is, and to represent it
internally as-is. We thus maintain in the Abstract Syntax Tree (AST)
as much information as possible so that one can transform this AST and
unparse it in a new file while preserving the coding style of the
original file. Yacfe preserves the whitespaces, newlines, indentation,
and comments from the original file, as well as the C preprocessor
(cpp) macros and cpp directives.
here
Soon