<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Delftware</title>
	<atom:link href="http://delftware.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://delftware.wordpress.com</link>
	<description>Another blog about Software Language Engineering.</description>
	<lastBuildDate>Tue, 02 Mar 2010 19:22:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='delftware.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Delftware</title>
		<link>http://delftware.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://delftware.wordpress.com/osd.xml" title="Delftware" />
	<atom:link rel='hub' href='http://delftware.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Strategic Lenses, Episode I: Two Simple Lenses</title>
		<link>http://delftware.wordpress.com/2010/02/22/strategic-lenses-episode-1/</link>
		<comments>http://delftware.wordpress.com/2010/02/22/strategic-lenses-episode-1/#comments</comments>
		<pubDate>Mon, 22 Feb 2010 19:44:54 +0000</pubDate>
		<dc:creator>guwac</dc:creator>
				<category><![CDATA[DSLs]]></category>
		<category><![CDATA[software transformation]]></category>
		<category><![CDATA[bidirectional transformations]]></category>
		<category><![CDATA[grammarware]]></category>
		<category><![CDATA[lenses]]></category>
		<category><![CDATA[Stratego/XT]]></category>

		<guid isPermaLink="false">http://delftware.wordpress.com/?p=123</guid>
		<description><![CDATA[In my last post, I discussed lenses as means to specify well-behaved bidirectional transformations. In this post, I introduce two very simple lenses: identity and composition. Both lenses are part of a bidirectional transformation language working on terms. Its syntax is specified in SDF while its semantics is defined by term rewriting rules in Stratego. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=delftware.wordpress.com&amp;blog=11085179&amp;post=123&amp;subd=delftware&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">In my last post, I discussed lenses as means to specify well-behaved bidirectional transformations. In this post, I introduce two very simple lenses: identity and composition. Both lenses are part of a bidirectional transformation language working on terms. Its syntax is specified in <a title="SDF Language for Modular Syntax Definitions" href="http://strategoxt.org/Sdf/WebHome" target="_blank">SDF</a> while its semantics is defined by term rewriting rules in <a title="Stratego Language" href="http://strategoxt.org/Stratego/StrategoLanguage" target="_blank">Stratego</a>.</p>
<p style="text-align:justify;"><span id="more-123"></span></p>
<p style="text-align:justify;"><strong>Identity</strong></p>
<p style="text-align:justify;">This is a very simple lens. It maps between identical concrete and abstract models. From concrete to abstract models, <em>get</em> simply copies the concrete model. In the opposite direction, <em>put</em> and <em>create</em> copy the abstract model:</p>
<ol>
<li><em>id</em>.<em>get</em>(<em>c</em>) = <em>c</em></li>
<li><em>id</em>.<em>put</em>(<em>a</em>, <em>c</em>) = <em>a</em></li>
<li><em>id</em>.<em>create</em>(<em>a</em>) = <em>a</em></li>
</ol>
<p style="text-align:justify;">The notion <em>l</em>.<em>f</em> refers to the function <em>f</em> of a particular lens <em>l</em> of interest. <em>id</em> denotes the <em>identity</em> lens. This lens obeys all three round-tripping laws:</p>
<ol>
<li><em>id</em>.<em>get</em>(<em>id</em>.<em>put</em>(<em>a</em>, <em>c</em>)) = <em>id</em>.<em>get</em>(<em>a</em>) = <em>a</em></li>
<li><em>id</em>.<em>get</em>(<em>id</em>.<em>create</em>(<em>a</em>)) = <em>id</em>.<em>get</em>(<em>a</em>) = <em>a</em></li>
<li><em>id</em>.<em>put</em>(<em>id</em>.<em>get</em>(<em>c</em>), <em>c</em>) = <em>id</em>.<em>put</em>(<em>c</em>, <em>c</em>) = <em>c</em></li>
</ol>
<p><strong>Composition</strong></p>
<p style="text-align:justify;">This lens combines two lenses <em>l1</em> and <em>l2</em> sequentially to a new lens <em>(l1 ; l2)</em>. To <em>get</em> an abstract model from a concrete model <em>c</em>, <em>l1</em>.<em>get</em> and <em>l2</em>.<em>get</em> are applied sequentially. The <em>put</em> function of the combined lens is slightly more difficult. First, <em>l2</em>.<em>put</em> is applied to put back the abstract model into the temporary model <em>l2</em>.<em>get</em> was applied to. This temporary model is the result of <em>l1</em>.<em>get</em>. This step yields an updated temporary model. In the next step, the updated temporary model is put back into the original concrete model by applying <em>l1</em>.<em>put</em>. The <em>create</em> function is simple again. First, <em>l2.create</em> is applied to the abstract model. Afterwards, <em>l1.create</em> is applied to the result:</p>
<ol>
<li><em>(l1 ; l2)</em>.<em>get</em>(<em>c</em>) = <em>l2</em>.<em>get</em>(<em>l1</em>.<em>get</em>(<em>c</em>))</li>
<li><em>(l1 ; l2)</em>.<em>put</em>(<em>a</em>, <em>c</em>) = <em>l1</em>.<em>put</em>(<em>l2</em>.<em>put</em>(<em>a</em>, <em>l1</em>.<em>get</em>(<em>c</em>)), <em>c</em>)</li>
<li><em>(l1 ; l2)</em>.<em>create</em>(<em>a</em>) = <em>l1</em>.<em>create</em>(<em>l2.create</em>(<em>a</em>))</li>
</ol>
<p style="text-align:justify;">The composition <em>(l1 ; l2)</em> fulfils the round-tripping laws if <em>l1</em> and <em>l2</em> do so:</p>
<ol>
<li><em>(l1 ; l2)</em>.<em>get</em>(<em>(l1 ; l2)</em>.<em>put</em>(<em>a</em>, <em>c</em>)) =<br />
<em>l2</em>.<em>get</em>(<em><strong>l1</strong></em><strong>.</strong><em><strong>get</strong></em><strong>(</strong><em><strong>l1</strong></em><strong>.</strong><em><strong>put</strong></em><strong>(</strong><em>l2</em>.<em>put</em>(<em>a</em>, <em>l1</em>.<em>get</em>(<em>c</em>))<strong>, </strong><em><strong>c</strong></em><strong>))</strong>) =<br />
<em>l2</em>.<em>get</em>(<em>l2</em>.<em>put</em>(<em>a</em>, <em>l1</em>.<em>get</em>(<em>c</em>))) = <em>a</em></li>
<li><em>(l1 ; l2)</em>.get(<em>(l1 ; l2)</em>.<em>create</em>(<em>a</em>)) =<br />
<em>l2</em>.<em>get</em>(<em><strong>l1</strong></em><strong>.</strong><em><strong>get</strong></em><strong>(</strong><em><strong>l1</strong></em><strong>.</strong><em><strong>create</strong></em><strong>(</strong><em>l2.create</em>(<em>a</em>)<strong>))</strong>) =<br />
<em>l2</em>.<em>get</em>(<em>l2.create</em>(<em>a</em>)) = <em>a</em></li>
<li><em>(l1 ; l2)</em>.<em>put</em>(<em>(l1 ; l2)</em>.<em>get</em>(<em>c</em>), <em>c</em>) =<br />
<em>l1</em>.<em>put</em>(<em><strong>l2</strong></em><strong>.</strong><em><strong>put</strong></em><strong>(</strong><em><strong>l2</strong></em>.<em><strong>get</strong></em>(<em>l1</em>.<em>get</em>(<em>c</em>))<strong>,</strong> <em>l1</em>.<em>get</em>(<em>c</em>)<strong>)</strong>, <em>c</em>) =<br />
<em>l1</em>.<em>put</em>(<em>l1</em>.<em>get</em>(<em>c</em>)), <em>c</em>) = <em>c</em></li>
</ol>
<p><strong>Defining a DSL</strong></p>
<p style="text-align:justify;">We now take <em>identity</em> and <em>composition</em> as a starting point for a bidirectional transformation language working on terms. First, we need to define a concrete syntax for this language. For this purpose, the metalanguage of choice is <a title="SDF Language for Modular Syntax Definitions" href="http://strategoxt.org/Sdf/WebHome" target="_blank">SDF</a> which integrates lexical and context-free syntax in one formalism, supports arbitrary context-free grammars, and enables language reuse by a module system. Here is an SDF module defining a concrete syntax for the two lenses discussed so far:</p>
<p style="padding-left:30px;"><code><strong><span style="color:#800080;"> module</span></strong> StrategicLenses<br />
<strong> </strong><br />
<span style="color:#800080;"><strong>imports</strong></span> Common<br />
<strong> </strong><br />
<strong><span style="color:#800080;">exports</span></strong><span style="color:#800080;"> </span><strong><span style="color:#800080;">context-free syntax</span></strong><br />
"id"          <span style="color:#333399;">-&gt;</span> Lens     <span style="color:#333399;">{</span>cons<span style="color:#333399;">(</span>"Id"<span style="color:#333399;">)}</span><br />
Lens ";" Lens <span style="color:#333399;">-&gt;</span> Lens     <span style="color:#333399;">{</span><strong><span style="color:#800080;">left</span></strong><span style="color:#333399;">,</span> cons<span style="color:#333399;">(</span>"Comp"<span style="color:#333399;">)}</span><br />
</code></p>
<p style="text-align:justify;">This module reuses another module called <code>Common</code> which provides definitions for syntactic sorts like <code>ID</code>, <code>INT</code> and <code>STRING</code> as well as typical layout definitions including comments. For each lens, there is a rule defining the syntactic sort <code>Lens</code>. The second rule is attributed being <code><strong><span style="color:#800080;">left</span></strong></code> associative to avoid ambiguity. Finally, both rules are attributed with a <code>cons</code>tructor name for nodes in abstract syntax trees. With SDF, abstract syntax trees are represented as terms. A signature for such terms can be derived from a SDF syntax definition. Here is the signature for our transformation language:</p>
<p style="padding-left:30px;"><code><strong><span style="color:#800080;"> module</span></strong> StrategicLenses<br />
<strong> </strong><br />
<strong><span style="color:#800080;"> signature constructors<br />
</span></strong> Comp <span style="color:#333399;">:</span> Lens <span style="color:#333399;">*</span> Lens <span style="color:#333399;">-&gt;</span> Lens<br />
Id   <span style="color:#333399;">:</span> Lens<br />
</code></p>
<p style="text-align:justify;">We rely on such term representations when we specify the dynamic semantics of both lenses by term rewriting rules in <a title="Stratego Language" href="http://strategoxt.org/Stratego/StrategoLanguage" target="_blank">Stratego</a>. Here are the rules for <em>identity</em>:</p>
<p style="padding-left:30px;"><code><strong><span style="color:#800080;">module</span></strong> Semantics<br />
<strong> </strong><br />
<span style="color:#800080;"><strong> imports </strong></span>libstratego-lib StrategicLenses<br />
<strong> </strong><br />
<strong><span style="color:#800080;"> rules</span></strong><br />
get    <span style="color:#333399;">:</span> <span style="color:#333399;">(</span>Id<span style="color:#333399;">(),</span> c<span style="color:#333399;">)    -&gt; </span>c<br />
put    <span style="color:#333399;">:</span><strong> </strong><span style="color:#333399;">(</span>Id<span style="color:#333399;">(),</span> a<span style="color:#333399;">,</span> c<span style="color:#333399;">)</span> <span style="color:#333399;"> -&gt;</span> a<br />
create <span style="color:#333399;">:</span> (Id<span style="color:#333399;">(),</span> a<span style="color:#333399;">)    -&gt; </span>a</code></p>
<p style="text-align:justify;">This module imports the Stratego standard library and the signature  <code>StrategicLenses</code> mentioned before. There is a rewrite rule for each lens function. The fundamental idea is to rewrite tuples consisting of a lens and the arguments of the function into the result of the function. The first rule specifies the <em>get</em> function. It rewrites a pair consisting of the <em>identity</em> lens and a concrete model <code>c</code> to <code>c</code>. The second rule specifies the <em>put</em> function. Since this function takes two arguments — an abstract model <code>a</code> and a concrete model <code>c</code>, it rewrites a triple consisting of the identity lens, <code>a</code>, and <code>c</code> to the abstract model <code>a</code>. The third rule specifies the <em>create</em> function analogously.</p>
<p style="text-align:justify;">Here are the rules for <em>composition</em>:</p>
<p style="padding-left:30px;"><code><strong><span style="color:#800080;"> rules</span></strong><br />
get    <span style="color:#333399;">:</span> <span style="color:#333399;">(</span>Comp<span style="color:#333399;">(</span>l1<span style="color:#333399;">,</span> l2<span style="color:#333399;">),</span> c<span style="color:#333399;">)    -&gt; &lt;</span>get<span style="color:#333399;">&gt;</span> <span style="color:#333399;">(</span>l2<span style="color:#333399;">,</span> <span style="color:#333399;">&lt;</span>get<span style="color:#333399;">&gt;</span> <span style="color:#333399;">(</span>l1<span style="color:#333399;">,</span> c<span style="color:#333399;">))</span><br />
put    <span style="color:#333399;">:</span> <span style="color:#333399;">(</span>Comp<span style="color:#333399;">(</span>l1<span style="color:#333399;">,</span> l2<span style="color:#333399;">)</span><span style="color:#333399;">,</span> a<span style="color:#333399;">,</span> c<span style="color:#333399;">)</span> <span style="color:#333399;">-&gt;</span> <span style="color:#333399;">&lt;</span>put<span style="color:#333399;">&gt;</span> <span style="color:#333399;">(</span>l1<span style="color:#333399;">,</span> <span style="color:#333399;">&lt;</span>put<span style="color:#333399;">&gt;</span> <span style="color:#333399;">(</span>l2<span style="color:#333399;">,</span> a<span style="color:#333399;">,</span> <span style="color:#333399;">&lt;</span>get<span style="color:#333399;">&gt;</span> <span style="color:#333399;">(</span>l1<span style="color:#333399;">,</span> c<span style="color:#333399;">)</span><span style="color:#333399;">)</span><span style="color:#333399;">,</span> c<span style="color:#333399;">)</span><br />
create <span style="color:#333399;">:</span> <span style="color:#333399;">(</span>Comp<span style="color:#333399;">(</span>l1<span style="color:#333399;">,</span> l2<span style="color:#333399;">)</span><span style="color:#333399;">,</span> a<span style="color:#333399;">)    -&gt; &lt;</span>create<span style="color:#333399;">&gt;</span> <span style="color:#333399;">(</span>l1<span style="color:#333399;">,</span> <span style="color:#333399;">&lt;</span>create<span style="color:#333399;">&gt;</span> <span style="color:#333399;">(</span>l2<span style="color:#333399;">,</span> a<span style="color:#333399;">))</span></code></p>
<p style="text-align:justify;">Note that these rules have the same name as for <em>identity</em>. But they distinguish in the matching pattern for the lens. Here, a <em>composition</em> lens is matched and the two sub-lenses are bound to <code>l1</code> and <code>l2</code>, respectively. To specify the result of the functions, we need to apply rewriting rules recursively. Application of a rule is denoted by angle brackets. For example, the right-hand side of the first rule reads: Apply <code>get</code> to a pair consisting of <code>l2</code> and the result of applying <code>get</code> to the pair <code>(l1, c)</code>. This enables us to specify the three lens functions in a notation very similar to the one in the beginning of this post.</p>
<p style="text-align:justify;">Coming up next: Some useful lenses working on terms.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/delftware.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/delftware.wordpress.com/123/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/delftware.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/delftware.wordpress.com/123/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/delftware.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/delftware.wordpress.com/123/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/delftware.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/delftware.wordpress.com/123/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/delftware.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/delftware.wordpress.com/123/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/delftware.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/delftware.wordpress.com/123/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/delftware.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/delftware.wordpress.com/123/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=delftware.wordpress.com&amp;blog=11085179&amp;post=123&amp;subd=delftware&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://delftware.wordpress.com/2010/02/22/strategic-lenses-episode-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4abc8dcef14f6aab70a9e967d4a0174c?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">guwac</media:title>
		</media:content>
	</item>
		<item>
		<title>Strategic Lenses: Prologue</title>
		<link>http://delftware.wordpress.com/2010/02/15/strategic-lenses-prologue/</link>
		<comments>http://delftware.wordpress.com/2010/02/15/strategic-lenses-prologue/#comments</comments>
		<pubDate>Mon, 15 Feb 2010 17:45:23 +0000</pubDate>
		<dc:creator>guwac</dc:creator>
				<category><![CDATA[DSLs]]></category>
		<category><![CDATA[software transformation]]></category>
		<category><![CDATA[bidirectional transformations]]></category>
		<category><![CDATA[lenses]]></category>

		<guid isPermaLink="false">http://delftware.wordpress.com/?p=121</guid>
		<description><![CDATA[Inspired by my former colleague Arif Wider, I had a closer look on lenses recently. I started with reading some papers by Nate Foster et alii. You can find a bibliography including these papers at researchr.org. Next, I implemented some lenses in Stratego. These lenses work on terms. In an upcoming series of blog posts, I like [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=delftware.wordpress.com&amp;blog=11085179&amp;post=121&amp;subd=delftware&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">Inspired by my former colleague <a title="Arif Wider home page" href="http://metrik.informatik.hu-berlin.de/grk-wiki/index.php/Person:Wider" target="_blank">Arif Wider</a>, I had a closer look on <em>lenses</em> recently. I started with reading some papers by <a title="Nate Foster at Princeton" href="http://www.cs.princeton.edu/~jnfoster/" target="_blank">Nate Foster</a> et alii. You can find a <a title="A Bibliography on Lenses" href="http://researchr.org/bibliography/lenses" target="_blank">bibliography</a> including these papers at <a title="Researchr" href="http://researchr.org/" target="_blank">researchr.org</a>. Next, I implemented some lenses in <a title="Stratego Transformation Language" href="http://www.strategoxt.org" target="_blank">Stratego</a>. These lenses work on terms. In an upcoming series of blog posts, I like to share some insights. This post starts the series with the overall idea of lenses.</p>
<p style="text-align:justify;"><span id="more-121"></span>Lenses provide means to specify well-behaved bidirectional transformations between more concrete “things” — let&#8217;s say models — and more abstract models.  Given a set <em>C</em> of concrete models and a set <em>A</em> of abstract models, a lens comprises three total functions:</p>
<ol style="text-align:justify;">
<li style="text-align:justify;"><em>get</em>: <em>C</em> → <em>A</em></li>
<li><em>put</em>: <em>A</em> × <em>C</em> → <em>C</em></li>
<li><em>create</em>: <em>A</em> → <em>C</em></li>
</ol>
<p style="text-align:justify;">The <em>get</em> function derives an abstract model from a concrete model. This abstract model is basically a view on the concrete model. The <em>put</em> function takes an updated abstract model and its original concrete model as arguments, yielding an updated concrete model which reflects the updates of the abstract model. If no concrete model exists, the <em>create</em> function constructs a concrete model from an abstract one. To ensure well-behaveness these functions must obey the following <em>round-tripping laws</em>:</p>
<ol style="text-align:justify;">
<li><em>get</em>(<em>put</em>(<em>a</em>, <em>c</em>)) = <em>a</em></li>
<li><em>get</em>(<em>create</em>(<em>a</em>)) = <em>a</em></li>
<li><em>put</em>(<em>get</em>(<em>c</em>), <em>c</em>) = <em>c</em></li>
</ol>
<p style="text-align:justify;">If we update an abstract model and propagate this update back into an old concrete model by a lens&#8217; <em>put</em> function, we expect that the new concrete model reflects this update completely. The first law — the <em>PutGet</em> law — guarantees this. It requires that applying the lens&#8217; <em>get</em> function to the new concrete model must yield exactly the updated abstract model. That is, no update detail is lost during the put. Similarly, we expect a concrete model which is initially created from an abstract model by a lens&#8217; <em>create</em> function to contain all the information of the abstract model. We must be able to derive the very same abstract model from the concrete model by the lens&#8217; <em>get</em> function. This is ensured by the second law — the <em>CreateGet</em> law. Finally, if we derive an abstract model from a concrete one by a lens&#8217; <em>get</em> function and <em>put</em> this abstract model without any modifications back into the original concrete model, we expect the concrete model to stay unmodified, too. The third law — the <em>GetPut</em> law — enforces this behaviour.</p>
<p style="text-align:justify;">Well, this is simply what we expect from a bidirectional transformation. We can implement the three functions of a lens in any programming language and have to prove the three round-tripping laws. The first step might be quite easy and the second one might become a nightmare, particularly if implementation changes. So what is so special about lenses? Where is the benefit? The idea is to use lenses as first class citizens in a bidirectional transformation language. This language provides a set of basic lenses and combinators for these lenses as means to specify bidirectional transformations. You can simply define new lenses by combining existing lenses. The round-tripping laws are proven for the basic lenses and the static semantics of the language guarantee that a combination of lenses is well-formed and the round-tripping laws hold for the combination as well. Dynamic semantics of the language specify how the three functions of a combined lens can be derived from its constituting base lenses and combinators. Thus, dynamic semantics release you from writing separate functions for your bidirectional transformation while static semantics release you from proving the round-tripping laws.</p>
<p style="text-align:justify;">Coming up next: How to specify lenses in <a title="Stratego Transformation Language" href="http://www.strategoxt.org" target="_blank">Stratego</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/delftware.wordpress.com/121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/delftware.wordpress.com/121/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/delftware.wordpress.com/121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/delftware.wordpress.com/121/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/delftware.wordpress.com/121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/delftware.wordpress.com/121/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/delftware.wordpress.com/121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/delftware.wordpress.com/121/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/delftware.wordpress.com/121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/delftware.wordpress.com/121/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/delftware.wordpress.com/121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/delftware.wordpress.com/121/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/delftware.wordpress.com/121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/delftware.wordpress.com/121/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=delftware.wordpress.com&amp;blog=11085179&amp;post=121&amp;subd=delftware&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://delftware.wordpress.com/2010/02/15/strategic-lenses-prologue/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4abc8dcef14f6aab70a9e967d4a0174c?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">guwac</media:title>
		</media:content>
	</item>
		<item>
		<title>Installing WebDSL</title>
		<link>http://delftware.wordpress.com/2010/01/11/installing-webdsl/</link>
		<comments>http://delftware.wordpress.com/2010/01/11/installing-webdsl/#comments</comments>
		<pubDate>Mon, 11 Jan 2010 19:01:10 +0000</pubDate>
		<dc:creator>guwac</dc:creator>
				<category><![CDATA[DSLs]]></category>
		<category><![CDATA[grammarware]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Snow Leopard]]></category>
		<category><![CDATA[WebDSL]]></category>

		<guid isPermaLink="false">http://delftware.wordpress.com/?p=96</guid>
		<description><![CDATA[WebDSL is a domain-specific language for the implementation of dynamic web applications. It consists of a core language with constructs to define entities, pages and business logic. Higher-level abstractions, modelling access control and workflow, are defined in a modular fashion as extensions of the core language. To develop your own web applications with WebDSL, you [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=delftware.wordpress.com&amp;blog=11085179&amp;post=96&amp;subd=delftware&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;"><a title="WebDSL" href="http://webdsl.org" target="_blank">WebDSL</a> is a domain-specific language for the implementation of dynamic web applications. It consists of a core language with constructs to define entities, pages and business logic. Higher-level abstractions, modelling access control and workflow, are defined in a modular fashion as extensions of the core language. To develop your own web applications with WebDSL, you need two things: The WebDSL tools and a runtime for web applications.</p>
<p style="text-align:justify;">I needed to install both on a Mac running Snow Leopard. Here is how it works.</p>
<p><span id="more-96"></span></p>
<p style="text-align:justify;"><strong>1. Installing Apple&#8217;s <a onclick="return mugicPopWin(this,event);" oncontextmenu="mugicRightClick(this);" title="Xcode" href="http://developer.apple.com/tools/xcode/" target="_blank"><strong>Xcode</strong></a> Developer Tools.<br />
</strong></p>
<p style="text-align:justify;">Xcode is Apple&#8217;s development environment for Mac OS X. You will find an installer on your Snow Leopard installation DVD and on the <a onclick="return mugicPopWin(this,event);" oncontextmenu="mugicRightClick(this);" title="Apple Developer Connection" href="http://connect.apple.com/" target="_blank">Apple Developer Connection</a> site. Make sure to install the optional components for Unix development. Next, you should install the latest software updates for Mac OS X and Xcode by running Software Update.</p>
<p style="text-align:justify;"><strong>2. Installing <a title="MacPorts" href="http://www.macports.org/" target="_blank">MacPorts</a>.</strong></p>
<p style="text-align:justify;">MacPorts is a free and open-source package management system that simplifies the installation of open-source software on a Mac. Follow the instructions on the <a title="MacPorts installation" href="http://www.macports.org/install.php" target="_blank">MacPorts installation</a> site. For me, the Snow Leopard Package installer worked fine. Make sure to update MacPorts by running</p>
<p><code>sudo port -v selfupdate</code></p>
<p style="text-align:justify;">Afterwards, your <code>~/.profile</code> file should include this line:</p>
<p><code>export PATH=/opt/local/bin:/opt/local/sbin:$PATH</code></p>
<p style="text-align:justify;"><strong>3. Installing <a title="Nix" href="http://nixos.org/nix/" target="_blank">Nix</a>.</strong></p>
<p style="text-align:justify;">Nix is another free and open-source package management system. In order to build Nix from source, you will need some tools which can easily be installed with MacPorts:</p>
<p><code>sudo port install curl m4 autoconf automake pkgconfig libtool</code></p>
<p style="text-align:justify;">Now, you should get the source of the <a title="Nix development release" href="http://hydra.nixos.org/view/nix/trunk/latest">latest development release</a> of Nix. After extraction, switch to the source directory and build Nix using these commands:</p>
<p><code>./configure<br />
make<br />
sudo make install<br />
sudo chown -R $USER /nix</code></p>
<p style="text-align:justify;">Next, you need to add these lines to your <code>~/.profile</code> file:</p>
<p><code>. /usr/local/etc/profile.d/nix.sh<br />
export PKG_CONFIG_PATH=~/.nix-profile/lib/pkgconfig:$PKG_CONFIG_PATH</code></p>
<p style="text-align:justify;"><strong>4. Installing <a title="WebDSL" href="http://webdsl.org" target="_blank">WebDSL</a>.</strong></p>
<p style="text-align:justify;">WebDSL is continuously built, tested and released by Hydra, a Nix-based continuous <a title="Build farm" href="http://hydra.nixos.org" target="_blank">build system</a>. You register for the latest builds by running these commands:</p>
<p><code>nix-channel --add http://hydra.nixos.org/channel/latest<br />
nix-channel --update</code></p>
<p style="text-align:justify;">Now, you can install the latest build of WebDSL:</p>
<p><code>nix-env --system-filter x86_64-darwin -i webdsl</code></p>
<p style="text-align:justify;">The <code>--system-filter x86_64-darwin</code> option ensures that you get the 64-bit version appropriate for Snow Leopard. Since 64-bit pointers need some space, you need to increase the stack size. Add this line to your <code>~/.profile</code> file:</p>
<p><code>ulimit -s 64000</code></p>
<p style="text-align:justify;"><strong>5. Installing <a title="Apache Tomcat" href="http://tomcat.apache.org/" target="_blank">Apache Tomcat</a>.</strong></p>
<p style="text-align:justify;">Apache Tomcat provides a web server environment. In this environment, you can run your web applications developed with WebDSL. You should download the Binary Distribution Core from the <a title="Apache Tomcat Download Page" href="http://tomcat.apache.org/download-60.cgi" target="_blank">Apache Tomcat Download Page</a>. Extract the archive to an appropriate directory. Include the <code>bin</code> subdirectory to your <code>PATH</code> environment in your <code>.profile</code> file:</p>
<p><code>export PATH=<em>YourInstallationDirectory</em>/bin:$PATH</code></p>
<p style="text-align:justify;"><strong>6. Installing <a title="MySQL" href="http://mysql.com/" target="_blank">MySQL</a>.</strong></p>
<p style="text-align:justify;">MySQL is a relational database management system. Your WebDSL applications rely on it for data persistence. You can download a package installer for the current version of the <a title="MySQL Community Server" href="http://dev.mysql.com/downloads/mysql/5.1.html#macosx-dmg" target="_blank">MySQL Community Server</a>. Make sure to get the 64-bit version and run the package installer. Furthermore, you should install the preference pane by double-clicking it. For more details, see the <a title="MySQL installation instructions" href="http://dev.mysql.com/doc/refman/5.1/en/mac-os-x-installation.html" target="_blank">installation instructions</a>. Update your <code>PATH</code> environment in your <code>.profile</code> file:</p>
<p style="text-align:justify;"><code>export PATH=usr/local/mysql/bin:$PATH</code></p>
<p style="text-align:justify;"><strong>7. Test your installation.</strong></p>
<p>Now it&#8217;s time to test your installation. First, start Tomcat:</p>
<p><code>startup.sh</code></p>
<p>Next, start MySQL from the MySQL preference pane:</p>
<p><img src="http://delftware.files.wordpress.com/2010/01/screen-shot-2010-01-11-at-7-43-47-pm.png?w=650" alt="" /></p>
<p style="text-align:justify;">You have now a working runtime environment for dynamic web applications. In order to test WebDSL, create a sample application by running</p>
<p><code>webdsl new</code></p>
<p>You need to provide some information. In most cases, default values work fine. Here is a sample configuration (<strong>bold</strong> user input):</p>
<p><code>Application name (one word): <strong>test</strong><br />
---- Database information ----<br />
You will now be asked for database info such as hostname, username, password and database. Do note that this script will check if this information is valid, if it is not, it will attempt to create the database with the given username and password for you.<br />
MySQL Host [localhost]:<br />
MySQL Username [webdsluser]:<br />
MySQL Password []:<br />
MySQL Database [webdsldb]:<br />
Hibernate database mode (create-drop / update / false) [create-drop]<br />
Now checking if database info works.<br />
Enter password:<br />
Unsuccessful, will now attempt to create database. For this we need your MySQL's root password (by default this is blank).<br />
MySQL root password:<br />
Now checking if database creation worked...<br />
Enter password:<br />
Yes!<br />
Do you want to configure your application for sending email? [y/n] <strong>n</strong><br />
---- Tomcat information ----<br />
Tomcat path for deployment [/opt/tomcat]: <strong>/Users/guwac/Programs/apache-tomcat-6.0.20</strong><br />
Now creating bare-bones application in application.app...<br />
override r--r--r--  guwac/staff for APPLICATION_NAME.app? <strong>n</strong><br />
Application created in application. You can now cd to this directory and call the webdsl script to compile your program.<br />
</code></p>
<p style="text-align:justify;">You can now build and deploy the test application:</p>
<p style="text-align:justify;"><code>cd test<br />
webdsl build<br />
webdsl deploy<br />
</code></p>
<p style="text-align:justify;">If everything worked fine, the test application is running at <a title="Test Application" href="http://localhost:8080/test" target="_blank">http://localhost:8080/test</a>. Finally, you can stop MySQL from the MySQL preference pane and stop Tomcat by running</p>
<p style="text-align:justify;"><code>shutdown.sh</code></p>
<p style="text-align:justify;"><strong>8. Have fun.</strong></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/delftware.wordpress.com/96/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/delftware.wordpress.com/96/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/delftware.wordpress.com/96/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/delftware.wordpress.com/96/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/delftware.wordpress.com/96/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/delftware.wordpress.com/96/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/delftware.wordpress.com/96/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/delftware.wordpress.com/96/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/delftware.wordpress.com/96/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/delftware.wordpress.com/96/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/delftware.wordpress.com/96/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/delftware.wordpress.com/96/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/delftware.wordpress.com/96/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/delftware.wordpress.com/96/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=delftware.wordpress.com&amp;blog=11085179&amp;post=96&amp;subd=delftware&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://delftware.wordpress.com/2010/01/11/installing-webdsl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4abc8dcef14f6aab70a9e967d4a0174c?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">guwac</media:title>
		</media:content>

		<media:content url="http://delftware.files.wordpress.com/2010/01/screen-shot-2010-01-11-at-7-43-47-pm.png" medium="image" />
	</item>
		<item>
		<title>Installing Stratego/XT</title>
		<link>http://delftware.wordpress.com/2009/12/30/installing-strategoxt/</link>
		<comments>http://delftware.wordpress.com/2009/12/30/installing-strategoxt/#comments</comments>
		<pubDate>Wed, 30 Dec 2009 10:45:00 +0000</pubDate>
		<dc:creator>guwac</dc:creator>
				<category><![CDATA[Metatools]]></category>
		<category><![CDATA[software transformation]]></category>
		<category><![CDATA[grammarware]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Snow Leopard]]></category>
		<category><![CDATA[Stratego/XT]]></category>

		<guid isPermaLink="false">http://delftware.wordpress.com/?p=3</guid>
		<description><![CDATA[Stratego/XT is a framework for the engineering of software transformation systems. The framework consists of two parts: Stratego, a software transformation language, and XT, a collection of tools for the generation of language processors like parsers, pretty-printers, parenthesizers, and format checkers. I needed to install the framework on a Mac running Snow Leopard. Here is [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=delftware.wordpress.com&amp;blog=11085179&amp;post=3&amp;subd=delftware&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;"><a title="Stratego/XT" href="http://strategoxt.org" target="_blank">Stratego/XT</a> is a framework for the engineering of software transformation systems. The framework consists of two parts: Stratego, a software transformation language, and XT, a collection of tools for the generation of language processors like parsers, pretty-printers, parenthesizers, and format checkers.</p>
<p style="text-align:justify;">I needed to install the framework on a Mac running Snow Leopard. Here is how it works.</p>
<p><span id="more-3"></span></p>
<p style="text-align:justify;"><strong>1. Installing Apple&#8217;s <a onclick="return mugicPopWin(this,event);" oncontextmenu="mugicRightClick(this);" title="Xcode" href="http://developer.apple.com/tools/xcode/" target="_blank"><strong>Xcode</strong></a> Developer Tools.<br />
</strong></p>
<p style="text-align:justify;">Xcode is Apple&#8217;s development environment for Mac OS X. You will find an installer on your Snow Leopard installation DVD and on the <a onclick="return mugicPopWin(this,event);" oncontextmenu="mugicRightClick(this);" title="Apple Developer Connection" href="http://connect.apple.com/" target="_blank">Apple Developer Connection</a> site. Make sure to install the optional components for Unix development. Next, you should install the latest software updates for Mac OS X and Xcode by running Software Update.</p>
<p style="text-align:justify;"><strong>2. Installing <a title="MacPorts" href="http://www.macports.org/" target="_blank">MacPorts</a>.</strong></p>
<p style="text-align:justify;">MacPorts is a free and open-source package management system that simplifies the installation of open-source software on a Mac. Follow the instructions on the <a title="MacPorts installation" href="http://www.macports.org/install.php" target="_blank">MacPorts installation</a> site. For me, the Snow Leopard Package installer worked fine. Make sure to update MacPorts by running</p>
<p><code>sudo port -v selfupdate</code></p>
<p style="text-align:justify;">Afterwards, your <code>~/.profile</code> file should include this line:</p>
<p><code>export PATH=/opt/local/bin:/opt/local/sbin:$PATH</code></p>
<p style="text-align:justify;"><strong>3. Installing <a title="Nix" href="http://nixos.org/nix/" target="_blank">Nix</a>.</strong></p>
<p style="text-align:justify;">Nix is another free and open-source package management system. In order to build Nix from source, you will need some tools which can easily be installed with MacPorts:</p>
<p><code>sudo port install curl m4 autoconf automake pkgconfig libtool</code></p>
<p style="text-align:justify;">Now, you should get the source of the <a title="Nix development release" href="http://hydra.nixos.org/view/nix/trunk/latest">latest development release</a> of Nix. After extraction, switch to the source directory and build Nix using these commands:</p>
<p><code>./configure<br />
make<br />
sudo make install<br />
sudo chown -R $USER /nix</code></p>
<p style="text-align:justify;">Next, you need to add these lines to your <code>~/.profile</code> file:</p>
<p><code>. /usr/local/etc/profile.d/nix.sh<br />
export PKG_CONFIG_PATH=~/.nix-profile/lib/pkgconfig:$PKG_CONFIG_PATH</code></p>
<p style="text-align:justify;"><strong>4. Installing <a title="Stratego/XT" href="http://strategoxt.org" target="_blank">Stratego/XT</a>.</strong></p>
<p style="text-align:justify;">Stratego/XT is continuously built, tested and released by Hydra, a Nix-based continuous <a title="Build farm" href="http://hydra.nixos.org" target="_blank">build system</a>. You register for the latest builds by running these commands:</p>
<p><code>nix-channel --add http://hydra.nixos.org/channel/latest<br />
nix-channel --update</code></p>
<p style="text-align:justify;">Now, you can install the latest build of Stratego/XT:</p>
<p><code>nix-env --system-filter x86_64-darwin -i aterm-2.5 java-front sdf2-bundle strategoxt</code></p>
<p style="text-align:justify;">The <code>--system-filter x86_64-darwin</code> option ensures that you get the 64-bit version appropriate for Snow Leopard.</p>
<p style="text-align:justify;"><strong>5. Installing missing libraries.</strong></p>
<p style="text-align:justify;">Usually, this step should not be necessary but it was for me. The Stratego compiler was missing these two libraries:</p>
<p><code>/usr/lib/libreadline.6.0.dylib<br />
/usr/lib/libhistory.6.0.dylib</code></p>
<p style="text-align:justify;">You can fix this by installing the readline libraries with MacPorts and creating symbolic links for the missing libraries:</p>
<p><code>sudo port install readline<br />
sudo ln -s /opt/local/lib/libreadline.6.0.dylib /usr/lib/<br />
sudo ln -s /opt/local/lib/libhistory.6.0.dylib /usr/lib/</code></p>
<p style="text-align:justify;"><strong>6. Have fun.</strong></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/delftware.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/delftware.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/delftware.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/delftware.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/delftware.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/delftware.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/delftware.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/delftware.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/delftware.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/delftware.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/delftware.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/delftware.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/delftware.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/delftware.wordpress.com/3/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=delftware.wordpress.com&amp;blog=11085179&amp;post=3&amp;subd=delftware&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://delftware.wordpress.com/2009/12/30/installing-strategoxt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4abc8dcef14f6aab70a9e967d4a0174c?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">guwac</media:title>
		</media:content>
	</item>
	</channel>
</rss>
