On Sat, 27 Nov 2010, Carl-Daniel Hailfinger wrote: > On 27.11.2010 17:46, Julia Lawall wrote: > > On Sat, 27 Nov 2010, Jani Monoses wrote > >> On 11/27/2010 02:44 PM, Julia Lawall wrote: > >> > >>> 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. > > > > This may be a dumb question, but is there any reason the C++ parser in > llvm/clang can't be used? It is compatible with gcc, and AFAIK it is > rather easy to make it spit out an AST in the format you want. > The LLVM developers are very open to suggestions, and many people have > used LLVM in their own projects. > Apparently LLVM ships with OCaml bindings by default, so it may not be > too hard to use it.
Perhaps it relies on CPP (ie expansion of macros) having been performed in advance? Coccinelle needs to parse the code as it is, not parse it into some simplified internal representation, so that it can reconstruct the code after transformation. This includes keeping information about all whitespace and comments. julia _______________________________________________ Cocci mailing list [email protected] http://lists.diku.dk/mailman/listinfo/cocci (Web access from inside DIKUs LAN only)
