
"Noel Yap" wrote
On 3/7/06, Andy Littlewrote:
I guess so, except high altitude mountain climbing over the AST using copious supplies of oxygen might be nearer the mark than walking. As I understand it C++ is not beloved by compiler writers for this reason! I guess it all comes down to the exact definition of "a C++ parser"and what you want to do with its output.
Some things I had in mind were: - code beautification - static dependency analysis for link- or compile-compatibility - other static code analysis - creation of refactoring tools
I think you would have to go quite deep to do those things. One simple example is that you need to find out if a name is a type or an object to continue parsing an expression, then you have all the leftovers from C, the weird C useage of typedef etc that must be catered for. IOW C++ parsing is not cleanly split into syntax and semantics as theorists like to have it. I read somewhere that the most recent gcc C++ parser was ultimately written by hand based on a recursive descent parser, as was Bjarne Stroustrups original. He mentions it somewhere in D&E I think. Anyway I'm sure it would be an interesting topic on the Spirit developers list! regards Andy Little