<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: JVM Compiler Construction with Scala and BCEL, Part 1</title>
	<atom:link href="http://www.deskchecked.com/2007/11/03/jvm-compiler-construction-with-scala-and-bcel-part-1/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.deskchecked.com/2007/11/03/jvm-compiler-construction-with-scala-and-bcel-part-1/</link>
	<description>Thomas Lee's programming blog</description>
	<lastBuildDate>Sat, 27 Mar 2010 16:01:14 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Thomas Lee &#187; JVM Compiler Construction with Scala and BCEL, Part 1.5</title>
		<link>http://www.deskchecked.com/2007/11/03/jvm-compiler-construction-with-scala-and-bcel-part-1/comment-page-1/#comment-1351</link>
		<dc:creator>Thomas Lee &#187; JVM Compiler Construction with Scala and BCEL, Part 1.5</dc:creator>
		<pubDate>Wed, 09 Jul 2008 11:16:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.vector-seven.com/2007/11/03/jvm-compiler-construction-with-scala-and-bcel-part-1/#comment-1351</guid>
		<description>[...] part 1 was published, Scala 2.7 has been released which &#8212; among other things &#8212; introduced [...]</description>
		<content:encoded><![CDATA[<p>[...] part 1 was published, Scala 2.7 has been released which &#8212; among other things &#8212; introduced [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James Iry</title>
		<link>http://www.deskchecked.com/2007/11/03/jvm-compiler-construction-with-scala-and-bcel-part-1/comment-page-1/#comment-322</link>
		<dc:creator>James Iry</dc:creator>
		<pubDate>Wed, 14 Nov 2007 18:53:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.vector-seven.com/2007/11/03/jvm-compiler-construction-with-scala-and-bcel-part-1/#comment-322</guid>
		<description>Very nice! I&#039;m looking forward to the rest.

In the article you say &quot;although Iâ€™m still not sure whatâ€™s intrinsically special about functional languages that would make them more appropriate for combinators.&quot;

The answer is they&#039;re very easy to see in purely functional terms.  A parser is a function that converts a stream of characters or tokens into a list of possible parses.  Each possible parse is something like a parse tree plus the remainder of the stream that wasn&#039;t parsed.   A parser combinator is a higher order function that takes one such parser function and applies a function to the parser to produce a second, more complex, parser.

Monads happen to be a really easy way to build just such higher order functions and they come straight out of the functional world.  As coincidence would have it, my next article on monads will demonstrate how a parser combinator library is built under the covers in Scala and I&#039;ll use arithmetic as my example.  :-)  

Now, higher order functions can be emulated in straight OO languages by using classs.  It just might be a bit clunkier.  JParsec is in fact a monadic parser combinator library for everybody&#039;s favorite J language: http://jparsec.codehaus.org/.

Two other interesting links on OO and parser combinators come from Gilad Bracha, formerly of Java fame but now more into Smalltalk and derivatives.   Here he gives an overview of the OO view of parser combinators: http://gbracha.blogspot.com/2007/01/parser-combinators.html.

Here he talks about a distinctively OO way of reusing one base parser to produce different kinds of output: http://bracha.org/executableGrammars.pdf.  Unfortunately, he concludes that the technique isn&#039;t very compatible with static typing.</description>
		<content:encoded><![CDATA[<p>Very nice! I&#8217;m looking forward to the rest.</p>
<p>In the article you say &#8220;although Iâ€™m still not sure whatâ€™s intrinsically special about functional languages that would make them more appropriate for combinators.&#8221;</p>
<p>The answer is they&#8217;re very easy to see in purely functional terms.  A parser is a function that converts a stream of characters or tokens into a list of possible parses.  Each possible parse is something like a parse tree plus the remainder of the stream that wasn&#8217;t parsed.   A parser combinator is a higher order function that takes one such parser function and applies a function to the parser to produce a second, more complex, parser.</p>
<p>Monads happen to be a really easy way to build just such higher order functions and they come straight out of the functional world.  As coincidence would have it, my next article on monads will demonstrate how a parser combinator library is built under the covers in Scala and I&#8217;ll use arithmetic as my example.  <img src='http://www.deskchecked.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />   </p>
<p>Now, higher order functions can be emulated in straight OO languages by using classs.  It just might be a bit clunkier.  JParsec is in fact a monadic parser combinator library for everybody&#8217;s favorite J language: <a href="http://jparsec.codehaus.org/" rel="nofollow">http://jparsec.codehaus.org/</a>.</p>
<p>Two other interesting links on OO and parser combinators come from Gilad Bracha, formerly of Java fame but now more into Smalltalk and derivatives.   Here he gives an overview of the OO view of parser combinators: <a href="http://gbracha.blogspot.com/2007/01/parser-combinators.html" rel="nofollow">http://gbracha.blogspot.com/2007/01/parser-combinators.html</a>.</p>
<p>Here he talks about a distinctively OO way of reusing one base parser to produce different kinds of output: <a href="http://bracha.org/executableGrammars.pdf" rel="nofollow">http://bracha.org/executableGrammars.pdf</a>.  Unfortunately, he concludes that the technique isn&#8217;t very compatible with static typing.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Thomas Lee &#187; Anonymous Type Acrobatics With Scala</title>
		<link>http://www.deskchecked.com/2007/11/03/jvm-compiler-construction-with-scala-and-bcel-part-1/comment-page-1/#comment-314</link>
		<dc:creator>Thomas Lee &#187; Anonymous Type Acrobatics With Scala</dc:creator>
		<pubDate>Mon, 12 Nov 2007 12:43:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.vector-seven.com/2007/11/03/jvm-compiler-construction-with-scala-and-bcel-part-1/#comment-314</guid>
		<description>[...] mentioned in passing at the beginning of a recent article, one of the coolest things made possible by Scala&#8217;s expressive type system are anonymous type [...]</description>
		<content:encoded><![CDATA[<p>[...] mentioned in passing at the beginning of a recent article, one of the coolest things made possible by Scala&#8217;s expressive type system are anonymous type [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tom</title>
		<link>http://www.deskchecked.com/2007/11/03/jvm-compiler-construction-with-scala-and-bcel-part-1/comment-page-1/#comment-275</link>
		<dc:creator>tom</dc:creator>
		<pubDate>Sun, 04 Nov 2007 16:28:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.vector-seven.com/2007/11/03/jvm-compiler-construction-with-scala-and-bcel-part-1/#comment-275</guid>
		<description>Just fixed the broken link to Adriaan&#039;s original article, too.</description>
		<content:encoded><![CDATA[<p>Just fixed the broken link to Adriaan&#8217;s original article, too.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tom</title>
		<link>http://www.deskchecked.com/2007/11/03/jvm-compiler-construction-with-scala-and-bcel-part-1/comment-page-1/#comment-273</link>
		<dc:creator>tom</dc:creator>
		<pubDate>Sun, 04 Nov 2007 11:32:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.vector-seven.com/2007/11/03/jvm-compiler-construction-with-scala-and-bcel-part-1/#comment-273</guid>
		<description>Hi OJ! I should have been more explicit.

This tutorial is not for those completely new to compiler development: although I give a brief high level description of compiler internals, if you don&#039;t understand what a &quot;lexer&quot; is before reading this article you&#039;ll get very, very lost and I&#039;d suggest you do more reading. I&#039;ll update the prerequisites to reflect this.</description>
		<content:encoded><![CDATA[<p>Hi OJ! I should have been more explicit.</p>
<p>This tutorial is not for those completely new to compiler development: although I give a brief high level description of compiler internals, if you don&#8217;t understand what a &#8220;lexer&#8221; is before reading this article you&#8217;ll get very, very lost and I&#8217;d suggest you do more reading. I&#8217;ll update the prerequisites to reflect this.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: OJ</title>
		<link>http://www.deskchecked.com/2007/11/03/jvm-compiler-construction-with-scala-and-bcel-part-1/comment-page-1/#comment-272</link>
		<dc:creator>OJ</dc:creator>
		<pubDate>Sun, 04 Nov 2007 08:16:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.vector-seven.com/2007/11/03/jvm-compiler-construction-with-scala-and-bcel-part-1/#comment-272</guid>
		<description>Hey dude. This is a great little write-up. The only issue I can see with it is that it&#039;s probably going to go over the heads of the newbies you&#039;re targetting (those that are keen to learn about compiler construction). I&#039;m guessing they might get lost quite early in, but I am speculating :)

Might I suggest that you stick a few links in the article to more in-depth definitions of some key things that you briefly define (such as ASTs, Lexical Analysis, etc), even if they&#039;re just links to wikipedia? I know that in my travels I&#039;ve found it very helpful to have those links handy while reading things that I don&#039;t have a good knowlege of. Having them there increases the chance that people will make an effort to read up on it if they don&#039;t quite get it.

As I said, great write up. I enjoyed reading :)</description>
		<content:encoded><![CDATA[<p>Hey dude. This is a great little write-up. The only issue I can see with it is that it&#8217;s probably going to go over the heads of the newbies you&#8217;re targetting (those that are keen to learn about compiler construction). I&#8217;m guessing they might get lost quite early in, but I am speculating <img src='http://www.deskchecked.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Might I suggest that you stick a few links in the article to more in-depth definitions of some key things that you briefly define (such as ASTs, Lexical Analysis, etc), even if they&#8217;re just links to wikipedia? I know that in my travels I&#8217;ve found it very helpful to have those links handy while reading things that I don&#8217;t have a good knowlege of. Having them there increases the chance that people will make an effort to read up on it if they don&#8217;t quite get it.</p>
<p>As I said, great write up. I enjoyed reading <img src='http://www.deskchecked.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
</channel>
</rss>
