<?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/"
	>

<channel>
	<title>weaselhat &#187; Formal Methods</title>
	<atom:link href="http://www.weaselhat.com/category/formal/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.weaselhat.com</link>
	<description></description>
	<lastBuildDate>Sat, 29 May 2010 09:17:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>The Resurgence of Parallelism</title>
		<link>http://www.weaselhat.com/2010/05/29/the-resurgence-of-parallelism/</link>
		<comments>http://www.weaselhat.com/2010/05/29/the-resurgence-of-parallelism/#comments</comments>
		<pubDate>Sat, 29 May 2010 09:17:20 +0000</pubDate>
		<dc:creator>Michael Greenberg</dc:creator>
				<category><![CDATA[Programming Languages]]></category>

		<guid isPermaLink="false">http://www.weaselhat.com/?p=222</guid>
		<description><![CDATA[There&#8217;s an article in the CACM trying to restore historical context to research in parallel computation: The Resurgence of Parallelism. (One of) the answer(s), it seems, is functional programming: Parallelism is not new; the realization that it is essential for continued progress in high-performance computing is. Parallelism is not yet a paradigm, but may become [...]]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s an article in the CACM trying to restore historical context to research in parallel computation: <a href="http://cacm.acm.org/magazines/2010/6/92479-the-resurgence-of-parallelism/fulltext">The Resurgence of Parallelism</a>.  (One of) the answer(s), it seems, is functional programming:</p>
<blockquote><p>
Parallelism is not new; the realization that it is essential for continued progress in high-performance computing is. Parallelism is not yet a paradigm, but may become so if enough people adopt it as the standard practice and standard way of thinking about computation.</p>
<p>The new era of research in parallel processing can benefit from the results of the extensive research in the 1960s and 1970s, avoiding rediscovery of ideas already documented in the literature: shared memory multiprocessing, determinacy, functional programming, and virtual memory.
</p></blockquote>
<p>Via <a href="http://lambda-the-ultimate.org/node/3963">LtU</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.weaselhat.com/2010/05/29/the-resurgence-of-parallelism/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nested functions in GCC</title>
		<link>http://www.weaselhat.com/2010/03/03/nested-functions-in-gcc/</link>
		<comments>http://www.weaselhat.com/2010/03/03/nested-functions-in-gcc/#comments</comments>
		<pubDate>Wed, 03 Mar 2010 16:06:40 +0000</pubDate>
		<dc:creator>Michael Greenberg</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Programming Languages]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://www.weaselhat.com/?p=208</guid>
		<description><![CDATA[GCC supports &#8220;nested functions&#8221; using the -fnested-functions flag. When I first saw this, I was excited: closures in C! In the famous words of Admiral Ackbar, &#8220;it&#8217;s a trap!&#8221; C [Show Styled Code]: #include typedef int (*fptr)(int); fptr f(int arg) { int nested_function(int nested_arg) { return arg + nested_arg; } return &#038;nested_function; } void smash(int [...]]]></description>
			<content:encoded><![CDATA[<p>GCC supports &#8220;nested functions&#8221; using the <tt>-fnested-functions</tt> flag.  When I first saw this, I was excited: closures in C!  In the famous words of Admiral Ackbar, &#8220;it&#8217;s a trap!&#8221;</p>
<div class="synthi_code" style="display:none;" id ="plain_synthi_4c88eed0ba409">
<div class="synthi_header" style="font-weight:bold;"> C <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('styled_synthi_4c88eed0ba409').style.display='block';document.getElementById('plain_synthi_4c88eed0ba409').style.display='none';return false">Show Styled Code</a>]:</span></div>
<pre style="width:100%;overflow:auto;">
#include <stdio.h>

typedef int (*fptr)(int);

fptr f(int arg) {
  int nested_function(int nested_arg) {
    return arg + nested_arg;
  }

  return &#038;nested_function;
}

void smash(int arg) {
  return;
}

int main(void) {
  fptr g = f(10);
  printf(&#034;%d\n&#034;, (*g)(5));
  smash(12);
  // printf(&#034;%d\n&#034;, (*g)(5));
  fptr h = f(12);
  printf(&#034;%d\n&#034;, (*g)(5));
  printf(&#034;%d\n&#034;, (*h)(5));

  return 0;
}
</pre>
</div>
<div class="synthi_code" style="display:block;" id ="styled_synthi_4c88eed0ba409">
<div class="synthi_header" style="font-weight:bold;"> C <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('plain_synthi_4c88eed0ba409').style.display='block';document.getElementById('styled_synthi_4c88eed0ba409').style.display='none';return false">Show Plain Code</a>]:</span></div>
<div class="c" style="font-family: monospace;">
<ol>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #339933;">#include &lt;stdio.h&gt;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">typedef</span> <span style="color: #993333;">int</span> <span style="color: #66cc66;">&#40;</span>*fptr<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333;">int</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">fptr f<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">int</span> arg<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #993333;">int</span> nested_function<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">int</span> nested_arg<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">return</span> arg + nested_arg;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #b1b100;">return</span> &amp;nested_function;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">void</span> smash<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">int</span> arg<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #b1b100;">return</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">int</span> main<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">void</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; fptr g = f<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">10</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <a href="http://www.opengroup.org/onlinepubs/009695399/functions/printf.html"><span style="color: #000066;">printf</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;%d<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>, <span style="color: #66cc66;">&#40;</span>*g<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">5</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; smash<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">12</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #808080; font-style: italic;">// printf(&quot;%d\n&quot;, (*g)(5));</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; fptr h = f<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">12</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <a href="http://www.opengroup.org/onlinepubs/009695399/functions/printf.html"><span style="color: #000066;">printf</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;%d<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>, <span style="color: #66cc66;">&#40;</span>*g<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">5</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <a href="http://www.opengroup.org/onlinepubs/009695399/functions/printf.html"><span style="color: #000066;">printf</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;%d<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>, <span style="color: #66cc66;">&#40;</span>*h<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">5</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #b1b100;">return</span> <span style="color: #cc66cc;">0</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
<p>Try compiling (<tt>gcc -fnested-functions</tt>).  What does the second call to <tt>g</tt> produce&#8212;15 or 17?  Try uncommenting line 21.  What happens?  Does commenting out line 20 affect this?  What if line 19 is commented out, but lines 20 and 21 are uncommented?</p>
<p>I&#8217;m not sure this feature is worth it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.weaselhat.com/2010/03/03/nested-functions-in-gcc/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>POPL 2010</title>
		<link>http://www.weaselhat.com/2010/01/22/popl-2010/</link>
		<comments>http://www.weaselhat.com/2010/01/22/popl-2010/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 15:22:37 +0000</pubDate>
		<dc:creator>Michael Greenberg</dc:creator>
				<category><![CDATA[Presentations]]></category>
		<category><![CDATA[Programming Languages]]></category>

		<guid isPermaLink="false">http://www.weaselhat.com/?p=197</guid>
		<description><![CDATA[POPL 2010 has been a blast, with lots of great papers and conversation. I presented Contracts Made Manifest at 10:30am today, and the follow-up discussions contained enough ideas for years of research. (So stay tuned!)]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.cse.psu.edu/popl/10/">POPL 2010</a> has been a blast, with lots of great papers and conversation.  I presented <a href="http://www.cis.upenn.edu/~mgree/papers/popl2010_contracts_presentation.pdf">Contracts Made Manifest</a> at 10:30am today, and the follow-up discussions contained enough ideas for years of research.  (So stay tuned!)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.weaselhat.com/2010/01/22/popl-2010/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Contracts Made Manifest: final version</title>
		<link>http://www.weaselhat.com/2009/11/03/contracts-made-manifest-final-version/</link>
		<comments>http://www.weaselhat.com/2009/11/03/contracts-made-manifest-final-version/#comments</comments>
		<pubDate>Tue, 03 Nov 2009 17:03:30 +0000</pubDate>
		<dc:creator>Michael Greenberg</dc:creator>
				<category><![CDATA[Papers]]></category>
		<category><![CDATA[Programming Languages]]></category>

		<guid isPermaLink="false">http://www.weaselhat.com/?p=167</guid>
		<description><![CDATA[We&#8217;ve sent off the final version of Contracts Made Manifest. There have been quite a few improvements since submission, the most important of which is captured by Figure 1 from our paper: Our submission only addressed lax &#955;C, where we had an inexact translation &#966; into &#955;H and an exact translation &#968; out of &#955;H. [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;ve sent off the final version of <i><a href="http://www.cis.upenn.edu/~mgree/papers/popl2010_contracts.pdf" title="I think the link works, this time!">Contracts Made Manifest</a></i>.  There have been quite a few improvements since submission, the most important of which is captured by Figure 1 from our paper:</p>
<p><center><img src="http://www.weaselhat.com/wp-content/uploads/2009/11/axis.png" alt="The axis of blame" title="The axis of blame" width="369" height="134" class="size-full wp-image-168" /></center></p>
<p>Our submission only addressed lax &lambda;<sub>C</sub>, where we had an inexact translation &phi; into &lambda;<sub>H</sub> and an exact translation &psi; out of &lambda;<sub>H</sub>.  We show a dual situation for picky &lambda;<sub>C</sub>, where &phi; is exact and &psi; is inexact.  Intuitively, languages farther to the right on the &#8220;axis of blame&#8221; are pickier.  Translating from right to left preserves behavior exactly, but left-to-right translations generate terms that can blame more than their pre-images.  (There are examples in the paper.)  I should note that lax and picky &lambda;<sub>C</sub> seem to be the extremes of the axis of blame: I don&#8217;t see a natural way to be laxer than lax &lambda;<sub>C</sub> or pickier than picky &lambda;<sub>C</sub>.</p>
<p>We also show that restricting these calculi to first-order dependency leaves them exactly equivalent; before, we could only show an exact equivalence by eliminating all dependency.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.weaselhat.com/2009/11/03/contracts-made-manifest-final-version/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Locally installing LLVM with Ocaml bindings</title>
		<link>http://www.weaselhat.com/2009/09/24/llvm-ocaml-loca/</link>
		<comments>http://www.weaselhat.com/2009/09/24/llvm-ocaml-loca/#comments</comments>
		<pubDate>Thu, 24 Sep 2009 19:44:31 +0000</pubDate>
		<dc:creator>Michael Greenberg</dc:creator>
				<category><![CDATA[Programming Languages]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://www.weaselhat.com/?p=145</guid>
		<description><![CDATA[We can&#8217;t install software into the /usr tree at my office, so I end up having local installs of lots of software. Some things, like GODI, play well with this. I had some trouble finding the right way to get LLVM&#8216;s Ocaml bindings to work, so I figured I&#8217;d share the wealth. The following instructions [...]]]></description>
			<content:encoded><![CDATA[<p>We can&#8217;t install software into the /usr tree at my office, so I end up having local installs of lots of software.  Some things, like <a href="http://godi.camlcity.org/godi/index.html">GODI</a>, play well with this.  I had some trouble finding the right way to get <a href="http://llvm.org">LLVM</a>&#8216;s Ocaml bindings to work, so I figured I&#8217;d share the wealth.  The following instructions will put an install into the directory <tt>$PREFIX/llvm-install</tt>.</p>
<p>Here are the steps; they&#8217;re followed by a plain English explanation.</p>
<div class="synthi_code" style="display:none;" id ="plain_synthi_4c88eed1176e6">
<div class="synthi_header" style="font-weight:bold;"> Bash <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('styled_synthi_4c88eed1176e6').style.display='block';document.getElementById('plain_synthi_4c88eed1176e6').style.display='none';return false">Show Styled Code</a>]:</span></div>
<pre style="width:100%;overflow:auto;">
cd $PREFIX
svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm
wget http://llvm.org/releases/2.5/llvm-gcc4.2-2.5-x86-linux-RHEL4.tar.gz
tar xzf llvm-gcc4.2-2.5-x86-linux-RHEL4.tar.gz
mkdir llvm-objects llvm-install
cd llvm-objects
../llvm/configure --with-llvmgccdir=$PREFIX/llvm-gcc4.2-2.5-x86-linux-RHEL4 --enable-optimized --enable-jit --prefix=$PREFIX/llvm-install --with-ocaml-libdir=$GODI_PATH/lib/ocaml/std-lib
make
make install
</pre>
</div>
<div class="synthi_code" style="display:block;" id ="styled_synthi_4c88eed1176e6">
<div class="synthi_header" style="font-weight:bold;"> Bash <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('plain_synthi_4c88eed1176e6').style.display='block';document.getElementById('styled_synthi_4c88eed1176e6').style.display='none';return false">Show Plain Code</a>]:</span></div>
<div class="bash" style="font-family: monospace;">
<ol>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000066;">cd</span> <span style="color: #0000ff;">$PREFIX</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">wget http://llvm.org/releases/<span style="color: #cc66cc;">2.5</span>/llvm-gcc4<span style="color: #cc66cc;">.2</span><span style="color: #cc66cc;">-2.5</span>-x86-linux-RHEL4.tar.gz</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">tar xzf llvm-gcc4<span style="color: #cc66cc;">.2</span><span style="color: #cc66cc;">-2.5</span>-x86-linux-RHEL4.tar.gz</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">mkdir llvm-objects llvm-install</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000066;">cd</span> llvm-objects</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">../llvm/configure &#8211;with-<span style="color: #0000ff;">llvmgccdir=</span><span style="color: #0000ff;">$PREFIX</span>/llvm-gcc4<span style="color: #cc66cc;">.2</span><span style="color: #cc66cc;">-2.5</span>-x86-linux-RHEL4 &#8211;enable-optimized &#8211;enable-jit &#8211;<span style="color: #0000ff;">prefix=</span><span style="color: #0000ff;">$PREFIX</span>/llvm-install &#8211;with-ocaml-<span style="color: #0000ff;">libdir=</span><span style="color: #0000ff;">$GODI_PATH</span>/lib/ocaml/std-lib</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">make</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">make install </div>
</li>
</ol>
</div>
</div>
<p>My <tt>PREFIX</tt> is my home directory, and <tt>GODI_PATH = ~/godi</tt>.  First, we checkout the latest LLVM from SVN (step 2).  Then we download and extract the <a href="http://llvm.org/releases/download.html#2.5">latest release (2.5, as of writing) of LLVM-gcc</a> (steps 3 and 4).  (I couldn&#8217;t get the SVN version of LLVM-gcc to work with the SVN version of LLVM.)  Notably, LLVM does <i>not</i> support in-place builds, so we create the <tt>llvm-objects</tt> directory to actually build LLVM; we&#8217;ll install it into <tt>llvm-install</tt> (step 5).  We configure the software <i>from the <tt>llvm-objects</tt> directory</i> (steps 6 and 7).  The long configure is necessary; the only optional item is <tt>--enable-jit</tt>.  You may have to adjust your <tt>--with-ocaml-libdir</tt> to point to wherever your Ocaml libraries live.  Then make and make install (steps 8 and 9).  Voila!</p>
<p>To test it out, we can use the &#8220;Hello, World!&#8221; program written by <a href="http://lists.cs.uiuc.edu/pipermail/llvmdev/2007-October/010996.html">Gordon Henrikson</a>.  I had to change it a little to bring it up to date with the latest APIs (in particular, the global context had to be added).  You can download it as <a href="downloads/llvm_test.ml"><tt>llvm_test.ml</tt></a>.</p>
<div class="synthi_code" style="display:none;" id ="plain_synthi_4c88eed11d43c">
<div class="synthi_header" style="font-weight:bold;"> OCaml <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('styled_synthi_4c88eed11d43c').style.display='block';document.getElementById('plain_synthi_4c88eed11d43c').style.display='none';return false">Show Styled Code</a>]:</span></div>
<pre style="width:100%;overflow:auto;">
open Printf
open Llvm

let main filename =
   let c = create_context () in

   let i8_t  = i8_type c in
   let i32_t = i32_type c in

   let m = create_module c filename in

   (* @greeting = global [14 x i8] c&#034;Hello, world!\00&#034; *)
   let greeting =
     define_global &#034;greeting&#034; (const_string c &#034;Hello, world!\000&#034;) m in

   (* declare i32 @puts(i8* ) *)
   let puts =
     declare_function &#034;puts&#034;
       (function_type i32_t [|pointer_type i8_t|]) m in

   (* define i32 @main() { entry: *)
   let main = define_function &#034;main&#034; (function_type i32_t [| |]) m in
   let at_entry = builder_at_end c (entry_block main) in

   (* %tmp = getelementptr [14 x i8]* @greeting, i32 0, i32 0 *)
   let zero = const_int i32_t 0 in
   let str = build_gep greeting [| zero; zero |] &#034;tmp&#034; at_entry in

   (* call i32 @puts( i8* %tmp ) *)
   ignore (build_call puts [| str |] &#034;&#034; at_entry);

   (* ret void *)
   ignore (build_ret (const_null i32_t) at_entry);

   (* write the module to a file *)
   if not (Llvm_bitwriter.write_bitcode_file m filename) then exit 1;
   dispose_module m

let () = match Sys.argv with
  | [|_; filename|] -> main filename
  | _ -> main &#034;a.out&#034;
</pre>
</div>
<div class="synthi_code" style="display:block;" id ="styled_synthi_4c88eed11d43c">
<div class="synthi_header" style="font-weight:bold;"> OCaml <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('plain_synthi_4c88eed11d43c').style.display='block';document.getElementById('styled_synthi_4c88eed11d43c').style.display='none';return false">Show Plain Code</a>]:</span></div>
<div class="ocaml" style="font-family: monospace;">
<ol>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #06c; font-weight: bold;">open</span> <a href="http://caml.inria.fr/pub/docs/manual-ocaml/libref/Printf.html"><span style="">Printf</span></a></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #06c; font-weight: bold;">open</span> Llvm</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #06c; font-weight: bold;">let</span> main filename =</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #06c; font-weight: bold;">let</span> c = create_context <span style="color: #6c6;">&#40;</span><span style="color: #6c6;">&#41;</span> <span style="color: #06c; font-weight: bold;">in</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #06c; font-weight: bold;">let</span> i8_t&nbsp; = i8_type c <span style="color: #06c; font-weight: bold;">in</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #06c; font-weight: bold;">let</span> i32_t = i32_type c <span style="color: #06c; font-weight: bold;">in</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #06c; font-weight: bold;">let</span> m = create_module c filename <span style="color: #06c; font-weight: bold;">in</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #5d478b; font-style: italic;">(* @greeting = global [14 x i8] c&quot;Hello, world!\00&quot; *)</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #06c; font-weight: bold;">let</span> greeting =</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;define_global <span style="color: #3cb371;">&quot;greeting&quot;</span> <span style="color: #6c6;">&#40;</span>const_string c <span style="color: #3cb371;">&quot;Hello, world!\000&quot;</span><span style="color: #6c6;">&#41;</span> m <span style="color: #06c; font-weight: bold;">in</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #5d478b; font-style: italic;">(* declare i32 @puts(i8* ) *)</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #06c; font-weight: bold;">let</span> puts =</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;declare_function <span style="color: #3cb371;">&quot;puts&quot;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #6c6;">&#40;</span>function_type i32_t <span style="color: #6c6;">&#91;</span>|pointer_type i8_t|<span style="color: #6c6;">&#93;</span><span style="color: #6c6;">&#41;</span> m <span style="color: #06c; font-weight: bold;">in</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #5d478b; font-style: italic;">(* define i32 @main() { entry: *)</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #06c; font-weight: bold;">let</span> main = define_function <span style="color: #3cb371;">&quot;main&quot;</span> <span style="color: #6c6;">&#40;</span>function_type i32_t <span style="color: #6c6;">&#91;</span>| |<span style="color: #6c6;">&#93;</span><span style="color: #6c6;">&#41;</span> m <span style="color: #06c; font-weight: bold;">in</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #06c; font-weight: bold;">let</span> at_entry = builder_at_end c <span style="color: #6c6;">&#40;</span>entry_block main<span style="color: #6c6;">&#41;</span> <span style="color: #06c; font-weight: bold;">in</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #5d478b; font-style: italic;">(* %tmp = getelementptr [14 x i8]* @greeting, i32 0, i32 0 *)</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #06c; font-weight: bold;">let</span> zero = const_int i32_t <span style="color: #c6c;">0</span> <span style="color: #06c; font-weight: bold;">in</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #06c; font-weight: bold;">let</span> str = build_gep greeting <span style="color: #6c6;">&#91;</span>| zero; zero |<span style="color: #6c6;">&#93;</span> <span style="color: #3cb371;">&quot;tmp&quot;</span> at_entry <span style="color: #06c; font-weight: bold;">in</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #5d478b; font-style: italic;">(* call i32 @puts( i8* %tmp ) *)</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<a href="http://caml.inria.fr/pub/docs/manual-ocaml/libref/Pervasives.html#VALignore"><span style="">ignore</span></a> <span style="color: #6c6;">&#40;</span>build_call puts <span style="color: #6c6;">&#91;</span>| str |<span style="color: #6c6;">&#93;</span> <span style="color: #3cb371;">&quot;&quot;</span> at_entry<span style="color: #6c6;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #5d478b; font-style: italic;">(* ret void *)</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<a href="http://caml.inria.fr/pub/docs/manual-ocaml/libref/Pervasives.html#VALignore"><span style="">ignore</span></a> <span style="color: #6c6;">&#40;</span>build_ret <span style="color: #6c6;">&#40;</span>const_null i32_t<span style="color: #6c6;">&#41;</span> at_entry<span style="color: #6c6;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #5d478b; font-style: italic;">(* write the module to a file *)</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #06c; font-weight: bold;">if</span> <span style="color: #06c; font-weight: bold;">not</span> <span style="color: #6c6;">&#40;</span>Llvm_bitwriter.<span style="color: #060;">write_bitcode_file</span> m filename<span style="color: #6c6;">&#41;</span> <span style="color: #06c; font-weight: bold;">then</span> <a href="http://caml.inria.fr/pub/docs/manual-ocaml/libref/Pervasives.html#VALexit"><span style="">exit</span></a> <span style="color: #c6c;">1</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;dispose_module m</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #06c; font-weight: bold;">let</span> <span style="color: #6c6;">&#40;</span><span style="color: #6c6;">&#41;</span> = <span style="color: #06c; font-weight: bold;">match</span> <a href="http://caml.inria.fr/pub/docs/manual-ocaml/libref/Sys.html"><span style="">Sys</span></a>.<span style="color: #060;">argv</span> <span style="color: #06c; font-weight: bold;">with</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; | <span style="color: #6c6;">&#91;</span>|_; filename|<span style="color: #6c6;">&#93;</span> -&gt; main filename</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; | _ -&gt; main <span style="color: #3cb371;">&quot;a.out&quot;</span> </div>
</li>
</ol>
</div>
</div>
<p>Now we can compile:</p>
<div class="synthi_code" style="display:none;" id ="plain_synthi_4c88eed12af00">
<div class="synthi_header" style="font-weight:bold;"> Bash <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('styled_synthi_4c88eed12af00').style.display='block';document.getElementById('plain_synthi_4c88eed12af00').style.display='none';return false">Show Styled Code</a>]:</span></div>
<pre style="width:100%;overflow:auto;">
ocamlopt -cc g++ llvm.cmxa llvm_bitwriter.cmxa llvm_test.ml -o llvm_test
./llvm_test hello.bc # generates bitcode
$PREFIX/llvm-install/bin/llvm-dis hello.bc # disassembles bitcode into hello.ll
$PREFIX/llvm-install/bin/lli hello.bc # outputs &#034;Hello, world!&#034;
</pre>
</div>
<div class="synthi_code" style="display:block;" id ="styled_synthi_4c88eed12af00">
<div class="synthi_header" style="font-weight:bold;"> Bash <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('plain_synthi_4c88eed12af00').style.display='block';document.getElementById('styled_synthi_4c88eed12af00').style.display='none';return false">Show Plain Code</a>]:</span></div>
<div class="bash" style="font-family: monospace;">
<ol>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">ocamlopt -cc g++ llvm.cmxa llvm_bitwriter.cmxa llvm_test.ml -o llvm_test</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">./llvm_test hello.bc <span style="color: #808080; font-style: italic;"># generates bitcode</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$PREFIX</span>/llvm-install/bin/llvm-dis hello.bc <span style="color: #808080; font-style: italic;"># disassembles bitcode into hello.ll</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$PREFIX</span>/llvm-install/bin/lli hello.bc <span style="color: #808080; font-style: italic;"># outputs &quot;Hello, world!&quot; </span></div>
</li>
</ol>
</div>
</div>
<p>If interpretation via <tt>lli</tt> isn&#8217;t your bag, you can also compile to native code:</p>
<div class="synthi_code" style="display:none;" id ="plain_synthi_4c88eed12dddf">
<div class="synthi_header" style="font-weight:bold;"> Bash <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('styled_synthi_4c88eed12dddf').style.display='block';document.getElementById('plain_synthi_4c88eed12dddf').style.display='none';return false">Show Styled Code</a>]:</span></div>
<pre style="width:100%;overflow:auto;">
$PREFIX/llvm-install/bin/llc hello.bc # generates assembly, hello.s
gcc -o hello hello.s
./hello # outputs &#034;Hello, world!&#034;
</pre>
</div>
<div class="synthi_code" style="display:block;" id ="styled_synthi_4c88eed12dddf">
<div class="synthi_header" style="font-weight:bold;"> Bash <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('plain_synthi_4c88eed12dddf').style.display='block';document.getElementById('styled_synthi_4c88eed12dddf').style.display='none';return false">Show Plain Code</a>]:</span></div>
<div class="bash" style="font-family: monospace;">
<ol>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$PREFIX</span>/llvm-install/bin/llc hello.bc <span style="color: #808080; font-style: italic;"># generates assembly, hello.s</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">gcc -o hello hello.s</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">./hello <span style="color: #808080; font-style: italic;"># outputs &quot;Hello, world!&quot; </span></div>
</li>
</ol>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.weaselhat.com/2009/09/24/llvm-ocaml-loca/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Flapjax: A Programming Language for Ajax Applications</title>
		<link>http://www.weaselhat.com/2009/08/13/flapjax-2/</link>
		<comments>http://www.weaselhat.com/2009/08/13/flapjax-2/#comments</comments>
		<pubDate>Thu, 13 Aug 2009 16:00:29 +0000</pubDate>
		<dc:creator>Michael Greenberg</dc:creator>
				<category><![CDATA[Flapjax]]></category>
		<category><![CDATA[Papers]]></category>
		<category><![CDATA[Programming Languages]]></category>

		<guid isPermaLink="false">http://www.weaselhat.com/?p=122</guid>
		<description><![CDATA[I am immensely pleased to report that our paper on Flapjax was accepted to OOPSLA 2009. This paper presents Flapjax, a language designed for contemporary Web applications. These applications communicate with servers and have rich, interactive interfaces. Flapjax provides two key features that simplify writing these applications. First, it provides event streams, a uniform abstraction [...]]]></description>
			<content:encoded><![CDATA[<p>I am immensely pleased to report that <a href="http://www.cis.upenn.edu/~mgree/papers/oopsla2009_flapjax.pdf">our paper on Flapjax</a> was accepted to <a href="http://www.oopsla.org/oopsla2009/" title="My favorite conference name to say, perhaps my least favorite to type.  OOPSPLA, every time.">OOPSLA 2009</a>.</p>
<blockquote><p>
This paper presents Flapjax, a language designed for contemporary Web applications. These applications communicate with servers and have rich, interactive interfaces. Flapjax provides two key features that simplify writing these applications. First, it provides event streams, a uniform abstraction for communication within a program as well as with external Web services. Second, the language itself is reactive: it automatically tracks data dependencies and propagates updates along those data?ows. This allows developers to write reactive interfaces in a declarative and compositional style.</p>
<p>Flapjax is built on top of JavaScript. It runs on unmodi?ed browsers and readily interoperates with existing JavaScript code. It is usable as either a programming language (that is compiled to JavaScript) or as a JavaScript library, and is designed for both uses. This paper presents the language, its design decisions, and illustrative examples drawn from several working Flapjax applications.
</p></blockquote>
<p>The real heroes of this story are my co-authors.  Leo, Arjun, and Greg were there for the initial, heroic-effort-based implementation.  Jacob and Aleks wrote incredible applications with our dog food.  Shriram, of course, saw the whole thing through.  Very few of my contributions remain: the original compiler is gone (thank goodness); my <a href="http://www.cis.upenn.edu/~mgree/papers/ugrad_thesis.pdf">thesis work</a> is discussed briefly in <i>How many DOMs?</i> on page 15.  Here&#8217;s to a great team and a great experience (and a great language)!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.weaselhat.com/2009/08/13/flapjax-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Contracts Made Manifest</title>
		<link>http://www.weaselhat.com/2009/07/30/contracts-made-manifest/</link>
		<comments>http://www.weaselhat.com/2009/07/30/contracts-made-manifest/#comments</comments>
		<pubDate>Thu, 30 Jul 2009 20:31:49 +0000</pubDate>
		<dc:creator>Michael Greenberg</dc:creator>
				<category><![CDATA[Programming Languages]]></category>
		<category><![CDATA[Submissions]]></category>

		<guid isPermaLink="false">http://www.weaselhat.com/?p=117</guid>
		<description><![CDATA[Benjamin Pierce, Stephanie Weirich, and I submitted a paper to POPL 2010; it&#8217;s about contracts. Here&#8217;s the abstract: Since Findler and Felleisen introduced higher-order contracts, many variants of their system have been proposed. Broadly, these fall into two groups: some follow Findler and Felleisen in using latent contracts, purely dynamic checks that are transparent to [...]]]></description>
			<content:encoded><![CDATA[<p><a href="www.cis.upenn.edu/~bcpierce/">Benjamin Pierce</a>, <a href="www.cis.upenn.edu/~sweirich/">Stephanie Weirich</a>, and I <a href="http://www.cis.upenn.edu/~mgree/papers/popl2010_contracts.pdf">submitted a paper</a> to <a href="http://www.cse.psu.edu/popl/10/">POPL 2010</a>; it&#8217;s about contracts.  Here&#8217;s the abstract:</p>
<blockquote><p>
Since Findler and Felleisen introduced higher-order contracts, many variants of their system have been proposed. Broadly, these fall into two groups: some follow Findler and Felleisen in using latent contracts, purely dynamic checks that are transparent to the type system; others use manifest contracts, where refinement types record the most recent check that has been applied. These two approaches are generally assumed to be equivalent&#8212;different ways of implementing the same idea, one retaining a simple type system, and the other providing more static information. Our goal is to formalize and clarify this folklore understanding.</p>
<p>Our work extends that of Gronski and Flanagan, who defined a latent calculus \lambda_C and a manifest calculus \lambda_H, gave a translation \phi from \lambda_C to \lambda_H, and proved that if a \lambda_C term reduces to a constant, then so does its \phi-image. We enrich their account with a translation \psi in the opposite direction and prove an analogous theorem for \psi.</p>
<p>More importantly, we generalize the whole framework to dependent contracts, where the predicates in contracts can mention variables from the local context. This extension is both pragmatically crucial, supporting a much more interesting range of contracts, and theoretically challenging. We define dependent versions of \lambda_C (following Findler and Felleisen&#8217;s semantics) and \lambda_H, establish type soundness&#8212;a challenging result in itself, for \lambda_H&#8212;and extend \phi and \psi accordingly. Interestingly, the intuition that the two systems are equivalent appears to break down here: we show that \psi preserves behavior exactly, but that a natural extension of \phi to the dependent case will sometimes yield terms that blame more because of a subtle difference in the treatment of dependent function contracts when the codomain contract itself abuses the argument.
</p></blockquote>
<p><b>Edit on 2009-11-03:</b> there&#8217;s a <a href="http://www.weaselhat.com/2009/11/03/contracts-made-manifest-final-version/">newer version</a>, as will appear in <a href="http://www.cse.psu.edu/popl/10/accepted-papers.html">POPL 2010</a>.</p>
<p><b>Edit on 2010-01-22:</b> I have removed the link to the submission, since it is properly subsumed by our published paper.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.weaselhat.com/2009/07/30/contracts-made-manifest/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Open-Access Venue for Theoretical Computer Science</title>
		<link>http://www.weaselhat.com/2009/04/30/eptcs/</link>
		<comments>http://www.weaselhat.com/2009/04/30/eptcs/#comments</comments>
		<pubDate>Fri, 01 May 2009 01:58:00 +0000</pubDate>
		<dc:creator>Michael Greenberg</dc:creator>
				<category><![CDATA[Formal Methods]]></category>

		<guid isPermaLink="false">http://www.weaselhat.com/?p=86</guid>
		<description><![CDATA[Via the TYPES-announce mailing list: &#8230;we are launching &#160;&#160;Electronic Proceedings in Theoretic Computer Science (EPTCS) a new international refereed open access venue for the rapid electronic publication of the proceedings of workshops and conferences, and of festschrifts, etc, in the general area of theoretical computer science, broadly construed. This is exciting news! I&#8217;m even willing [...]]]></description>
			<content:encoded><![CDATA[<p>Via the <a href="http://lists.seas.upenn.edu/mailman/listinfo/types-announce" title="Under new management.">TYPES-announce</a> mailing list:</p>
<blockquote><p>
&#8230;we are launching</p>
<p>&nbsp;&nbsp;<a href="http://eptcs.org" title="Much abler than INEPTCS.">Electronic Proceedings in Theoretic Computer Science (EPTCS)</a></p>
<p>a new international refereed open access venue for the rapid<br />
electronic publication of the proceedings of workshops and<br />
conferences, and of festschrifts, etc, in the general area of<br />
theoretical computer science, broadly construed.
</p></blockquote>
<p>This is exciting news!  I&#8217;m even willing to overlook the fact the plural of &#8216;festschrift&#8217; is &#8216;festschriften&#8217;, not &#8216;festschrifts&#8217;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.weaselhat.com/2009/04/30/eptcs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flapjax TR</title>
		<link>http://www.weaselhat.com/2009/04/15/flapjax-tr/</link>
		<comments>http://www.weaselhat.com/2009/04/15/flapjax-tr/#comments</comments>
		<pubDate>Wed, 15 Apr 2009 14:44:25 +0000</pubDate>
		<dc:creator>Michael Greenberg</dc:creator>
				<category><![CDATA[Flapjax]]></category>
		<category><![CDATA[Programming Languages]]></category>

		<guid isPermaLink="false">http://www.weaselhat.com/?p=82</guid>
		<description><![CDATA[After much hard work (by more productive people), there is a technical report describing Flapjax. Check it out!]]></description>
			<content:encoded><![CDATA[<p>After much hard work (by <a href="http://www.cs.brown.edu/~arjun/" title="The Guhster, as we used to call him.">more</a> <a href="http://www.eecs.berkeley.edu/~lmeyerov/" title="Still working on browser stuff, it seems.">productive</a> <a href="http://www.cs.brown.edu/~sk/" title="Refers to himself as SKK.">people</a>), there is a <a href="http://www.cs.brown.edu/research/pubs/techreports/reports/CS-09-04.html" title="04?  Slow year, huh?">technical report describing Flapjax</a>.  Check it out!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.weaselhat.com/2009/04/15/flapjax-tr/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Debounce and other callback combinators</title>
		<link>http://www.weaselhat.com/2009/03/25/callback-combinators/</link>
		<comments>http://www.weaselhat.com/2009/03/25/callback-combinators/#comments</comments>
		<pubDate>Wed, 25 Mar 2009 15:27:48 +0000</pubDate>
		<dc:creator>Michael Greenberg</dc:creator>
				<category><![CDATA[Flapjax]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Programming Languages]]></category>

		<guid isPermaLink="false">http://www.weaselhat.com/?p=77</guid>
		<description><![CDATA[It is serendipitous that I noticed a blog post about a callback combinator while adding a few drops to the Flapjax bucket. Flapjax is nothing more than a coherent set of callback combinators. The key insight to this set of callback combinators is the &#8220;Event&#8221; abstraction &#8212; a Node in FJ&#8217;s implementation. Once callbacks are [...]]]></description>
			<content:encoded><![CDATA[<p>It is serendipitous that I noticed <a href="http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/" title="Debouncing, trampolining -- why don't people realize how exciting programming is?">a blog post about a callback combinator</a> while adding a few drops to the <a href="http://www.flapjax-lang.org/" title="Oh, the times we've had.">Flapjax bucket</a>.</p>
<p>Flapjax is nothing more than a coherent set of callback combinators.  The key insight to this set of callback combinators is the &#8220;Event&#8221; abstraction &#8212; a <tt>Node</tt> in FJ&#8217;s implementation.  Once callbacks are Nodes, you get two things:</p>
<ol>
<li>a handle that allows you to multiply operate on a single (time-varying) data source, and</li>
<li>a whole host of useful abstractions for manipulating handles: <tt>mergeE</tt>, <tt>calmE</tt>, <tt>switchE</tt>, etc.</li>
</ol>
<p>The last I saw the implementations of <a href="http://resume.cs.brown.edu/" title="This is really hard to search for.">Resume</a> and <a href="http://continue2.cs.brown.edu/" title="Last seen as Continue 1.0, honestly.">Continue</a>, they were built using this idea.  The more I think about it, the more the FJ-language seems like the wrong approach: the FJ-library is an <i>awesome</i> abstraction, in theory and practice.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.weaselhat.com/2009/03/25/callback-combinators/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
