<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Semantic Rewriting of Code with Pork &#8211; A bitter recap</title>
	<atom:link href="http://blog.mozilla.org/tglek/2009/01/29/semantic-rewriting-of-code-with-pork-a-bitter-recap/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.mozilla.org/tglek/2009/01/29/semantic-rewriting-of-code-with-pork-a-bitter-recap/</link>
	<description>Taras&#039; blog on Snappy, Startup, Telemetry and other Firefox peroformance matters</description>
	<lastBuildDate>Tue, 27 Nov 2012 16:50:13 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
	<item>
		<title>By: Richard</title>
		<link>http://blog.mozilla.org/tglek/2009/01/29/semantic-rewriting-of-code-with-pork-a-bitter-recap/comment-page-1/#comment-28641</link>
		<dc:creator>Richard</dc:creator>
		<pubDate>Fri, 13 Aug 2010 08:04:12 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.org/tglek/?p=108#comment-28641</guid>
		<description><![CDATA[I just had a look after reading your comment on LWN. Maybe you should spend some time documenting it, then it might see more use. For example, if I add a new parameter to a method, how would I go about changing all existing callers to, say, pass a NULL for that parameter?]]></description>
		<content:encoded><![CDATA[<p>I just had a look after reading your comment on LWN. Maybe you should spend some time documenting it, then it might see more use. For example, if I add a new parameter to a method, how would I go about changing all existing callers to, say, pass a NULL for that parameter?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mihai Vasilian</title>
		<link>http://blog.mozilla.org/tglek/2009/01/29/semantic-rewriting-of-code-with-pork-a-bitter-recap/comment-page-1/#comment-22659</link>
		<dc:creator>Mihai Vasilian</dc:creator>
		<pubDate>Thu, 11 Jun 2009 00:04:32 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.org/tglek/?p=108#comment-22659</guid>
		<description><![CDATA[I am glad to see this really great work.
I am interested in these kind of subjects.
I am looking for a decent refactoring solution that I will adapt for emacs. Or maybe I should already start writings one for myself. And later to give it to others too. I am thinking that everybody says reuse the existing work, but very few succeeded. Like you with Elkhound and Elsa, which is great. 
Hm,.. and meanwhile I started to write some containers. I with every day closer to my true project.
Mihai.]]></description>
		<content:encoded><![CDATA[<p>I am glad to see this really great work.<br />
I am interested in these kind of subjects.<br />
I am looking for a decent refactoring solution that I will adapt for emacs. Or maybe I should already start writings one for myself. And later to give it to others too. I am thinking that everybody says reuse the existing work, but very few succeeded. Like you with Elkhound and Elsa, which is great.<br />
Hm,.. and meanwhile I started to write some containers. I with every day closer to my true project.<br />
Mihai.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: yoann padioleau</title>
		<link>http://blog.mozilla.org/tglek/2009/01/29/semantic-rewriting-of-code-with-pork-a-bitter-recap/comment-page-1/#comment-21647</link>
		<dc:creator>yoann padioleau</dc:creator>
		<pubDate>Sat, 07 Mar 2009 22:15:26 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.org/tglek/?p=108#comment-21647</guid>
		<description><![CDATA[Yes, my paper at CC&#039;09 that I mentionned earlier in this
thread, talks about DMS in its related work.]]></description>
		<content:encoded><![CDATA[<p>Yes, my paper at CC&#8217;09 that I mentionned earlier in this<br />
thread, talks about DMS in its related work.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ira Baxter</title>
		<link>http://blog.mozilla.org/tglek/2009/01/29/semantic-rewriting-of-code-with-pork-a-bitter-recap/comment-page-1/#comment-21543</link>
		<dc:creator>Ira Baxter</dc:creator>
		<pubDate>Tue, 24 Feb 2009 08:24:23 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.org/tglek/?p=108#comment-21543</guid>
		<description><![CDATA[I agree, a robust C++ front end is a bitch.
Especially if you want to handle multiple dialects,
such as ANSI, GCC, Microsoft, ...

I&#039;m surprised that all this discussion hasn&#039;t raised the topic of the DMS Software Reengineering Toolkit, and its dialect-agile C++ front end and general program transformation capabilities.

DMS has been applied to C++ Avionics software to carry out massive program restructuring tasks. 

Here&#039;s a reference to a paper describing the tool
and the approach.

Case study: Re-engineering C++ component models via automatic program transformation
RL Akers, ID Baxter, M Mehlich, BJ Ellis, KR … - Information and Software Technology, 2007 - Elsevier

The website contains a fair amount of informaiton about DMS itself

www.semanticdesigns.com]]></description>
		<content:encoded><![CDATA[<p>I agree, a robust C++ front end is a bitch.<br />
Especially if you want to handle multiple dialects,<br />
such as ANSI, GCC, Microsoft, &#8230;</p>
<p>I&#8217;m surprised that all this discussion hasn&#8217;t raised the topic of the DMS Software Reengineering Toolkit, and its dialect-agile C++ front end and general program transformation capabilities.</p>
<p>DMS has been applied to C++ Avionics software to carry out massive program restructuring tasks. </p>
<p>Here&#8217;s a reference to a paper describing the tool<br />
and the approach.</p>
<p>Case study: Re-engineering C++ component models via automatic program transformation<br />
RL Akers, ID Baxter, M Mehlich, BJ Ellis, KR … &#8211; Information and Software Technology, 2007 &#8211; Elsevier</p>
<p>The website contains a fair amount of informaiton about DMS itself</p>
<p><a href="http://www.semanticdesigns.com" rel="nofollow">http://www.semanticdesigns.com</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike</title>
		<link>http://blog.mozilla.org/tglek/2009/01/29/semantic-rewriting-of-code-with-pork-a-bitter-recap/comment-page-1/#comment-21271</link>
		<dc:creator>Mike</dc:creator>
		<pubDate>Thu, 05 Feb 2009 05:28:35 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.org/tglek/?p=108#comment-21271</guid>
		<description><![CDATA[Hi,
thanks for clarifying this-well, if that&#039;s really the case, this project definitely needs more exposure, there&#039;s a whole multitude of related efforts, and there have been numerous attempts to come up with C++ parser to do such code analysis/transformation tasks. 

In fact, most major IDEs also come up with their own home-brewed C++ parser (check out eclipse and kdevelop in particular: http://bugs.kde.org/show_bug.cgi?id=66683)

There are so many tools that come up with half-working solutions, it would be truly awesome to have one self-contained piece of code, be it a standalone tool or library, which could be leveraged by all interested efforts. 

Hopefully, this would help pork grow and mature, so that everybody can contribute modifications.

Also, even after having checked out the docs here (and basically everything else I could find), it&#039;s hard to get a good grasp of the current status of the project, meaning I guess that it might help to spend one or two rainy weekends on improving the docs and documenting the state of affairs.

In fact, if there was a way to run pork via some simple web frontend CGI where users could submit a custom snippet of code, pick a transformation (rename, expand, move to scope...), might additionally help to improve awareness of the power of this project.

I really feel that it is pity that this project is so underdocumented. However, I also realize that the toolchain may really have to be purpose-agnostic, so that whatever tools are built on top of it, pork doesn&#039;t cause any unnecessary grief or extreme dependencies. 

Maybe one needs to provide wrapper on top of it, or even turn it into a &quot;service&quot; (daemon) where a user may connect to, submit a snippet of code, a transformation and the service responds with a diff and closes the connection. I think such things may actually help improve awareness. In addition, providing a service-wrapper on top of pork might actually help some people who&#039;d like to make use of pork functionality, without wanting to locally depend on the binaries. So, maybe this might really be an interesting idea?

Interested programmers could use such a thing in their perl/python scripts. Depending on the feedback, this may be extended, if there&#039;s demand.

In any case, if there&#039;s a way to set up a &quot;refactoring playground&quot; somewhere, this would probably be interesting for most people.

At the moment, I&#039;d imagine that many more people are interested in such a facility, than those who are interested in downloading, configuring, compiling and installing the toolchain. 
So, some simple way to try it out might be a good idea.

Even if it&#039;s just a web form with an text area where they can type some code (or optionally upload a file), and then run the transformation and be presented with the diff.

Actually, there are probably many open source projects that could (and probably would like to) benefit from something like pork, but usage needs to be as intuitive and straightforward as possible, making pork available via some sort of demo service might prove to be a good way for fellow open source project to become familiar with it.


regards,

Mike]]></description>
		<content:encoded><![CDATA[<p>Hi,<br />
thanks for clarifying this-well, if that&#8217;s really the case, this project definitely needs more exposure, there&#8217;s a whole multitude of related efforts, and there have been numerous attempts to come up with C++ parser to do such code analysis/transformation tasks. </p>
<p>In fact, most major IDEs also come up with their own home-brewed C++ parser (check out eclipse and kdevelop in particular: <a href="http://bugs.kde.org/show_bug.cgi?id=66683" rel="nofollow">http://bugs.kde.org/show_bug.cgi?id=66683</a>)</p>
<p>There are so many tools that come up with half-working solutions, it would be truly awesome to have one self-contained piece of code, be it a standalone tool or library, which could be leveraged by all interested efforts. </p>
<p>Hopefully, this would help pork grow and mature, so that everybody can contribute modifications.</p>
<p>Also, even after having checked out the docs here (and basically everything else I could find), it&#8217;s hard to get a good grasp of the current status of the project, meaning I guess that it might help to spend one or two rainy weekends on improving the docs and documenting the state of affairs.</p>
<p>In fact, if there was a way to run pork via some simple web frontend CGI where users could submit a custom snippet of code, pick a transformation (rename, expand, move to scope&#8230;), might additionally help to improve awareness of the power of this project.</p>
<p>I really feel that it is pity that this project is so underdocumented. However, I also realize that the toolchain may really have to be purpose-agnostic, so that whatever tools are built on top of it, pork doesn&#8217;t cause any unnecessary grief or extreme dependencies. </p>
<p>Maybe one needs to provide wrapper on top of it, or even turn it into a &#8220;service&#8221; (daemon) where a user may connect to, submit a snippet of code, a transformation and the service responds with a diff and closes the connection. I think such things may actually help improve awareness. In addition, providing a service-wrapper on top of pork might actually help some people who&#8217;d like to make use of pork functionality, without wanting to locally depend on the binaries. So, maybe this might really be an interesting idea?</p>
<p>Interested programmers could use such a thing in their perl/python scripts. Depending on the feedback, this may be extended, if there&#8217;s demand.</p>
<p>In any case, if there&#8217;s a way to set up a &#8220;refactoring playground&#8221; somewhere, this would probably be interesting for most people.</p>
<p>At the moment, I&#8217;d imagine that many more people are interested in such a facility, than those who are interested in downloading, configuring, compiling and installing the toolchain.<br />
So, some simple way to try it out might be a good idea.</p>
<p>Even if it&#8217;s just a web form with an text area where they can type some code (or optionally upload a file), and then run the transformation and be presented with the diff.</p>
<p>Actually, there are probably many open source projects that could (and probably would like to) benefit from something like pork, but usage needs to be as intuitive and straightforward as possible, making pork available via some sort of demo service might prove to be a good way for fellow open source project to become familiar with it.</p>
<p>regards,</p>
<p>Mike</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tglek</title>
		<link>http://blog.mozilla.org/tglek/2009/01/29/semantic-rewriting-of-code-with-pork-a-bitter-recap/comment-page-1/#comment-21261</link>
		<dc:creator>tglek</dc:creator>
		<pubDate>Wed, 04 Feb 2009 18:03:03 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.org/tglek/?p=108#comment-21261</guid>
		<description><![CDATA[Mike,
yes, that&#039;s what Pork does for Mozilla.]]></description>
		<content:encoded><![CDATA[<p>Mike,<br />
yes, that&#8217;s what Pork does for Mozilla.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike</title>
		<link>http://blog.mozilla.org/tglek/2009/01/29/semantic-rewriting-of-code-with-pork-a-bitter-recap/comment-page-1/#comment-21260</link>
		<dc:creator>Mike</dc:creator>
		<pubDate>Wed, 04 Feb 2009 17:58:02 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.org/tglek/?p=108#comment-21260</guid>
		<description><![CDATA[Would it be right to assume that pork is supposed to eventually facilitate code transformation/re-engineering scenarios such as those laid out at http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl?action=browse&amp;id=BoostSpiritCXXParser&amp;revision=48 ?]]></description>
		<content:encoded><![CDATA[<p>Would it be right to assume that pork is supposed to eventually facilitate code transformation/re-engineering scenarios such as those laid out at <a href="http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl?action=browse&#038;id=BoostSpiritCXXParser&#038;revision=48" rel="nofollow">http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl?action=browse&#038;id=BoostSpiritCXXParser&#038;revision=48</a> ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: yoann padioleau</title>
		<link>http://blog.mozilla.org/tglek/2009/01/29/semantic-rewriting-of-code-with-pork-a-bitter-recap/comment-page-1/#comment-21181</link>
		<dc:creator>yoann padioleau</dc:creator>
		<pubDate>Fri, 30 Jan 2009 23:55:02 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.org/tglek/?p=108#comment-21181</guid>
		<description><![CDATA[&gt; but the fact that you claim you can parse most of C is not &gt; reassuring.

Ok maybe I was not clear. We can parse all the C language with no problem. The problem is not C but cpp. We want to parse as-is the C files, and so to have in the AST the ifdefs, includes, define of macros, etc, and this is what is difficult. If you compile with gcc the kernel you will see that it compiles only 51% of the C files and only a portion of those C files (because of ifdefs). We, on the opposite, want to analyze all the source, not just the one you compile on your architecture. Maybe this is not a problem for mozilla, but for the linux kernel it is.

&gt; you and other academics insist on write parsers from scratch

We didn&#039;t really insist on that. We wanted at the beginning to reuse CIL but it turns out to be not well suited to what we wanted to do so we had to start from scratch. In the same way McPeak I guess was not satisfied with CIL either so he started elsa.
I looked at Elsa but it was coded in C++ and could not handle cpp the way we needed at that time (it was 3 years ago).
And except Necula I don&#039;t know many academics that did a parser from scratch. I know Torvalds did one with sparse, but Torvalds is not an academic.

&gt; In my experience 99% parsing of Mozilla is insufficient, it needs to be 100%

Well I don&#039;t have the same experience with Linux. If you can automate 99% of the work then people are already happy.

&gt; thinking they can solve the C++ refactoring problem by &gt; writing yet-another-parser

We never said this in the article or on our webpage or in our papers on coccinelle.

&gt; Pork(Elsa+MCPP+some utility code) is the best possible &gt; toolchain to build a C++ refactoring tool on at this &gt;point in time

Pork, or EDG, yes probably. I agree.
But we didn&#039;t want to make a refactoring tool (for C++), we wanted to make an easy-to-use program transformation DSL (for C). 

&gt; So it’s frustrating that researchers working in the &gt;area would rather give up on C++ refactoring instead of building upon what already works to take it further.

We didn&#039;t give up on C++ refactoring, we just had another research problem to solve: the need for a DSL for program transformation for the evolution of device drivers in Linux. 

&gt; If you have questions you’d like to see answered on the Pork page,

Just the one I asked you on LWN: how to specify with Pork the simple transformation about alloc and adding the if checking code (that must use the same variable), and what command line to apply it on the linux kernel.]]></description>
		<content:encoded><![CDATA[<p>&gt; but the fact that you claim you can parse most of C is not &gt; reassuring.</p>
<p>Ok maybe I was not clear. We can parse all the C language with no problem. The problem is not C but cpp. We want to parse as-is the C files, and so to have in the AST the ifdefs, includes, define of macros, etc, and this is what is difficult. If you compile with gcc the kernel you will see that it compiles only 51% of the C files and only a portion of those C files (because of ifdefs). We, on the opposite, want to analyze all the source, not just the one you compile on your architecture. Maybe this is not a problem for mozilla, but for the linux kernel it is.</p>
<p>&gt; you and other academics insist on write parsers from scratch</p>
<p>We didn&#8217;t really insist on that. We wanted at the beginning to reuse CIL but it turns out to be not well suited to what we wanted to do so we had to start from scratch. In the same way McPeak I guess was not satisfied with CIL either so he started elsa.<br />
I looked at Elsa but it was coded in C++ and could not handle cpp the way we needed at that time (it was 3 years ago).<br />
And except Necula I don&#8217;t know many academics that did a parser from scratch. I know Torvalds did one with sparse, but Torvalds is not an academic.</p>
<p>&gt; In my experience 99% parsing of Mozilla is insufficient, it needs to be 100%</p>
<p>Well I don&#8217;t have the same experience with Linux. If you can automate 99% of the work then people are already happy.</p>
<p>&gt; thinking they can solve the C++ refactoring problem by &gt; writing yet-another-parser</p>
<p>We never said this in the article or on our webpage or in our papers on coccinelle.</p>
<p>&gt; Pork(Elsa+MCPP+some utility code) is the best possible &gt; toolchain to build a C++ refactoring tool on at this &gt;point in time</p>
<p>Pork, or EDG, yes probably. I agree.<br />
But we didn&#8217;t want to make a refactoring tool (for C++), we wanted to make an easy-to-use program transformation DSL (for C). </p>
<p>&gt; So it’s frustrating that researchers working in the &gt;area would rather give up on C++ refactoring instead of building upon what already works to take it further.</p>
<p>We didn&#8217;t give up on C++ refactoring, we just had another research problem to solve: the need for a DSL for program transformation for the evolution of device drivers in Linux. </p>
<p>&gt; If you have questions you’d like to see answered on the Pork page,</p>
<p>Just the one I asked you on LWN: how to specify with Pork the simple transformation about alloc and adding the if checking code (that must use the same variable), and what command line to apply it on the linux kernel.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tglek</title>
		<link>http://blog.mozilla.org/tglek/2009/01/29/semantic-rewriting-of-code-with-pork-a-bitter-recap/comment-page-1/#comment-21179</link>
		<dc:creator>tglek</dc:creator>
		<pubDate>Fri, 30 Jan 2009 19:53:40 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.org/tglek/?p=108#comment-21179</guid>
		<description><![CDATA[I&#039;m sorry, perhaps I was too harsh on the C part. My main frustration is that C is much easier to do this to than C++, but the fact that you claim you can parse most of C is not reassuring.

Another issue is that fact you and other academics insist on write parsers from scratch. In my experience 99% parsing of Mozilla is insufficient, it needs to be 100% as that is more likely to result in a patch that compiles. Writing a C++ parser from scratch is a huge undertaking and based on experience of others I think you will eventually be forced to give up (due to the fact that full C++ parsing requires type elaboration which requires a couple of years of effort).

Also we aren&#039;t just renaming functions. If you look at the links in the article we can change function signatures and function bodies in significant way(with indepth analysis of existing code in prcheck and garburator. ie more than anything that eclipse/etc could ever hope for). In theory Pork supports any change one can dream up as opposed to being limited to what the DSL was designed to(obviously there are big upsides and downsides to that). 

I&#039;m also an OCaml guy myself, but I picked Elsa/etc(and ended up maintaining it) because it was(and still is) the only way to make complex code changes to C++ code. So I&#039;m sorry if I came across as attacking your particular tool, I was more upset that in general people keep thinking they can solve the C++ refactoring problem by writing yet-another-parser(ie by building upon their C work). 

I don&#039;t approve of the ml-mocking C++ style used in Elsa, nor do I approve of the stupid build system, but I do believe Pork(Elsa+MCPP+some utility code) is the best possible toolchain to build a C++ refactoring tool on at this point in time(in another 2-5 years Clang might take that place). So it&#039;s frustrating that researchers working in the area would rather give up on C++ refactoring instead of building upon what already works to take it further.

If you have questions you&#039;d like to see answered on the Pork page, I would really appreciate a list of questions and I&#039;ll make an FAQ out of them.]]></description>
		<content:encoded><![CDATA[<p>I&#8217;m sorry, perhaps I was too harsh on the C part. My main frustration is that C is much easier to do this to than C++, but the fact that you claim you can parse most of C is not reassuring.</p>
<p>Another issue is that fact you and other academics insist on write parsers from scratch. In my experience 99% parsing of Mozilla is insufficient, it needs to be 100% as that is more likely to result in a patch that compiles. Writing a C++ parser from scratch is a huge undertaking and based on experience of others I think you will eventually be forced to give up (due to the fact that full C++ parsing requires type elaboration which requires a couple of years of effort).</p>
<p>Also we aren&#8217;t just renaming functions. If you look at the links in the article we can change function signatures and function bodies in significant way(with indepth analysis of existing code in prcheck and garburator. ie more than anything that eclipse/etc could ever hope for). In theory Pork supports any change one can dream up as opposed to being limited to what the DSL was designed to(obviously there are big upsides and downsides to that). </p>
<p>I&#8217;m also an OCaml guy myself, but I picked Elsa/etc(and ended up maintaining it) because it was(and still is) the only way to make complex code changes to C++ code. So I&#8217;m sorry if I came across as attacking your particular tool, I was more upset that in general people keep thinking they can solve the C++ refactoring problem by writing yet-another-parser(ie by building upon their C work). </p>
<p>I don&#8217;t approve of the ml-mocking C++ style used in Elsa, nor do I approve of the stupid build system, but I do believe Pork(Elsa+MCPP+some utility code) is the best possible toolchain to build a C++ refactoring tool on at this point in time(in another 2-5 years Clang might take that place). So it&#8217;s frustrating that researchers working in the area would rather give up on C++ refactoring instead of building upon what already works to take it further.</p>
<p>If you have questions you&#8217;d like to see answered on the Pork page, I would really appreciate a list of questions and I&#8217;ll make an FAQ out of them.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tglek</title>
		<link>http://blog.mozilla.org/tglek/2009/01/29/semantic-rewriting-of-code-with-pork-a-bitter-recap/comment-page-1/#comment-21177</link>
		<dc:creator>tglek</dc:creator>
		<pubDate>Fri, 30 Jan 2009 15:36:28 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.org/tglek/?p=108#comment-21177</guid>
		<description><![CDATA[I didn&#039;t delete the comment as I was asleep :), looks like it failed the captcha. I approved it now.]]></description>
		<content:encoded><![CDATA[<p>I didn&#8217;t delete the comment as I was asleep <img src='http://blog.mozilla.org/tglek/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> , looks like it failed the captcha. I approved it now.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
