Quote:
I don't want to write compiler. I just want check cpp file.how I do it?
However you have to write two major components of a compiler, namely the
lexical analyzer
and the
parser
. Since
C++
is a really complex language your task is difficult and you probably need a library in order to accomplish it (unless you have a huge amount of time in your hands). Have a look at
DMS® Software Reengineering Toolkit™[
^]. If you could use
Java
then
ANTLR
is an option (you may find available
C++
grammars).
Another option, as already suggested, is using an actual
C++
compiler to perform the validation.