On Sat, 27 Nov 2010, Jani Monoses wrote: > On 11/27/2010 02:44 PM, Julia Lawall wrote: > > On Sat, 27 Nov 2010, Jani Monoses wrote: > > > > > Hello, > > > > > > I heard that writing a complete C++ parser is very hard, but I was > > > wondering > > > if Coccinelle could be made to work on C++ codebases > > > only handling the C subset of the language and ignoring what it does not > > > treat. > > > > > > If the whole AST is needed than this is probably unfeasable, but if > > > smaller > > > units can be handled independently then maybe very simple transformations > > > like > > > renaming functions or dropping arguments could be still done, ignoring > > > whether > > > the code is within a function or a method call. > > > > > > The only open source C++ code transformation tool I have heard of is Pork > > > but > > > it is much more difficult to set up and use than Coccinelle at the moment > > > so > > > it would be nice to be able to do relatively easy things > > > in C++ or mixed C/C++ codebases. > > > > I think it is possible, and indeed a C++ parser has been written that is > > compatible with Coccinelle. Doing the simple case as you suggest is even > > probably not too hard. But at the moment we do not have the resources to > > look into it. > > > > thanks for the prompt reply. > Is the C++ parser code available along with some documentation on how it can > be used with Coccinelle?
There is no documentation. Furthermore, it is only a parser, it does not construct an abstract syntax tree, so compatible with Coccinelle may not mean much more than it is written in ocaml. I think it is available, but I am not sure where. Perhaps Nicolas or Yoann can answer. Perhaps we could organize a project to connect the two. If anyone has some good arguments as to why the kinds of transformations Coccinelle is good at would be useful in C++ code, that could be helpful. Actually, I have never written anything in C++ :) julia _______________________________________________ Cocci mailing list [email protected] http://lists.diku.dk/mailman/listinfo/cocci (Web access from inside DIKUs LAN only)
