I am interested in C++ functions prototypes parsing. Are there solutions?
Printable View
I am interested in C++ functions prototypes parsing. Are there solutions?
I'm not quite sure if I understand what you mean... Could you elaborate?
Yes, I'm aware of what a function prototype means. However, what do you mean by parsing? Are you talking about identifying all function prototypes in a source file?
So where are you stuck? The first word would be the return type, the second word the function name, then you just alternate between types and names.
There would be preferably that result would be returned (success or fail) and incorrect code would be broken pretty quick. It is not difficult problem but if there is complete solution I would use it.
Maybe you should add a few more details about what you're trying to do.
Yes, there is a way to tell incorrect code; you can write the code and then use a program called a compiler on it. The compiler will tell you if the code is incorrect, and will usually give you details of which line(s) are wrong.
You could write a complete C parser. (A complete C++ parser would likely be far too much work.) Once you have that, identifying the function prototypes should be trivial.
One solution is to use a parser generator. The most well-known is Yacc,
http://en.wikipedia.org/wiki/Yacc