{"id":73,"date":"2004-02-19T14:21:24","date_gmt":"2004-02-19T13:21:24","guid":{"rendered":"http:\/\/www.nobugs.org\/blog\/archives\/2004\/02\/19\/c-refactoring-tools\/"},"modified":"2004-02-19T14:21:24","modified_gmt":"2004-02-19T13:21:24","slug":"c-refactoring-tools","status":"publish","type":"post","link":"https:\/\/www.nobugs.org\/blog\/archives\/2004\/02\/19\/c-refactoring-tools\/","title":{"rendered":"C++ Refactoring Tools"},"content":{"rendered":"<p>Well, I tried to kickstart this year&#8217;s attempt to write a C++ refactoring tool by asking <a href=\"http:\/\/www.edg.com\">EDG<\/a> if I could somehow get a cheap license for their C++ front end.  In the past, I&#8217;ve got bogged down in the difficulty of parsing C++ and always gave up in disgust, vowing never to waste my time on such a primitive language.  This time, I thought I could avoid doing the work myself and buy in a third party solution.  Unfortunately, EDG either want a big up-front sum, or some concrete guarantee that I&#8217;ll sell lots of copies of the (expensive) resulting software.  That&#8217;s understandable, since they need to make money, but it makes this approach unfeasible for me.<\/p>\n<p>A few days later, I notice that the <a href=\"http:\/\/www.xref.sk\/xrefactory\/development.html\">Xrefactory bods<\/a> have apparently been taking the same route recently.  Clever people!<\/p>\n<p>Of course, having a parsed-and-semantically-analysed representation of a C++ program is only half the battle.  In an ideal world, you&#8217;d throw <a href=\"http:\/\/c2.com\/cgi\/wiki?BillOpdyke\">Bill Opdyke&#8217;s thesis<\/a> at the problem and you&#8217;d be done.  But in the real world, you have a preprocessor to deal with.  Since C and C++ have a preprocessor which works at the lexical level, it can perform horrendously arbitary transformations on the program.  The preprocessor munges text, and has no awareness of the syntactic\/semantic structures which it is manipulating.  <\/p>\n<p>Refactoring in the presence of the preprocessor is hard.  Fortunately, some clever people have been worrying about this recently and published a <a href=\"http:\/\/jerry.cs.uiuc.edu\/~garrido\/CRefactory.html\">pile of papers<\/a> on the subject.<\/p>\n<p>I shall read these papers soon, become disgusted by the inelegance of C++ and give up on my &#8220;C++ refactoring tool&#8221; project for the fifth time.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Well, I tried to kickstart this year&#8217;s attempt to write a C++ refactoring tool by asking EDG if I could somehow get a cheap license for their C++ front end. In the past, I&#8217;ve got bogged down in the difficulty of parsing C++ and always gave up in disgust, vowing never to waste my time [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-73","post","type-post","status-publish","format-standard","hentry","category-programming"],"_links":{"self":[{"href":"https:\/\/www.nobugs.org\/blog\/wp-json\/wp\/v2\/posts\/73","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.nobugs.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.nobugs.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.nobugs.org\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nobugs.org\/blog\/wp-json\/wp\/v2\/comments?post=73"}],"version-history":[{"count":0,"href":"https:\/\/www.nobugs.org\/blog\/wp-json\/wp\/v2\/posts\/73\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.nobugs.org\/blog\/wp-json\/wp\/v2\/media?parent=73"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.nobugs.org\/blog\/wp-json\/wp\/v2\/categories?post=73"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.nobugs.org\/blog\/wp-json\/wp\/v2\/tags?post=73"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}