<?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: The Magic Behind Parser Combinators</title>
	<atom:link href="http://www.codecommit.com/blog/scala/the-magic-behind-parser-combinators/feed" rel="self" type="application/rss+xml" />
	<link>http://www.codecommit.com/blog/scala/the-magic-behind-parser-combinators</link>
	<description>(permanently in beta)</description>
	<lastBuildDate>Sun, 29 Aug 2010 20:01:44 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Søren B. Vrist</title>
		<link>http://www.codecommit.com/blog/scala/the-magic-behind-parser-combinators/comment-page-1#comment-5113</link>
		<dc:creator>Søren B. Vrist</dc:creator>
		<pubDate>Mon, 26 Jul 2010 09:28:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.codecommit.com/blog/scala/the-magic-behind-parser-combinators#comment-5113</guid>
		<description>Any chance for a follow up expanding on scala 2.8 angle on parser combinators? (packrat?)</description>
		<content:encoded><![CDATA[<p>Any chance for a follow up expanding on scala 2.8 angle on parser combinators? (packrat?)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Seth Tisue</title>
		<link>http://www.codecommit.com/blog/scala/the-magic-behind-parser-combinators/comment-page-1#comment-4955</link>
		<dc:creator>Seth Tisue</dc:creator>
		<pubDate>Mon, 29 Mar 2010 19:33:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.codecommit.com/blog/scala/the-magic-behind-parser-combinators#comment-4955</guid>
		<description>You write: &quot;hand-written parsers have a tendency toward poor performance (think: the Scala compiler)&quot;. Yes, the Scala compiler is slow, but the parsing phase isn&#039;t the bottleneck. It&#039;s later phases such as the type checker.</description>
		<content:encoded><![CDATA[<p>You write: &#8220;hand-written parsers have a tendency toward poor performance (think: the Scala compiler)&#8221;. Yes, the Scala compiler is slow, but the parsing phase isn&#8217;t the bottleneck. It&#8217;s later phases such as the type checker.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alexander Lehmann</title>
		<link>http://www.codecommit.com/blog/scala/the-magic-behind-parser-combinators/comment-page-1#comment-4954</link>
		<dc:creator>Alexander Lehmann</dc:creator>
		<pubDate>Sat, 27 Mar 2010 12:11:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.codecommit.com/blog/scala/the-magic-behind-parser-combinators#comment-4954</guid>
		<description>Wonderful post. Exactly what I was looking for (although, admittedly, it seems like I&#039;m one year late ;-)</description>
		<content:encoded><![CDATA[<p>Wonderful post. Exactly what I was looking for (although, admittedly, it seems like I&#8217;m one year late <img src='http://www.codecommit.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Axel Sammet</title>
		<link>http://www.codecommit.com/blog/scala/the-magic-behind-parser-combinators/comment-page-1#comment-4953</link>
		<dc:creator>Axel Sammet</dc:creator>
		<pubDate>Fri, 26 Mar 2010 12:02:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.codecommit.com/blog/scala/the-magic-behind-parser-combinators#comment-4953</guid>
		<description>I just stumbled from a google search across your blog. Thanks for the great insight. This helped me a lot to understand the behavior of my experimental parsers written in scala. I also noted the lack of activity in your blog ;-) Any chance, you find the time for more elaborations in the future?</description>
		<content:encoded><![CDATA[<p>I just stumbled from a google search across your blog. Thanks for the great insight. This helped me a lot to understand the behavior of my experimental parsers written in scala. I also noted the lack of activity in your blog <img src='http://www.codecommit.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  Any chance, you find the time for more elaborations in the future?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daniel Spiewak</title>
		<link>http://www.codecommit.com/blog/scala/the-magic-behind-parser-combinators/comment-page-1#comment-4872</link>
		<dc:creator>Daniel Spiewak</dc:creator>
		<pubDate>Sat, 01 Aug 2009 05:24:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.codecommit.com/blog/scala/the-magic-behind-parser-combinators#comment-4872</guid>
		<description>@gatoatigrado

GLR is interesting, but it has some fairly serious flaws.  For example, despite Tomita&#039;s claims, the algorithm is not O(n^3) in the worst case.  This grammar in particular is O(n^4) for all valid input:

&lt;pre&gt;
S ::= S S
    &#124; S S S
    &#124; b
&lt;/pre&gt;

Also, GLR is not fully generalized.  There are grammars for which GLR (as with any shift-reduce parsing technique) is undefined:

&lt;pre&gt;
A ::= B A a
    &#124; a

B ::= \epsilon
&lt;/pre&gt;

Granted, most GLR parser generators will transform the above grammar into something which is actually usable within the constraints of the algorithm, but it doesn&#039;t change the fact that GLR is not entirely what it claims to be.

Fortunately, there are algorithms which are fully-general and which attain cubic asymptotic bounds without absurd memory usage.  For example, GLL (Generalized LL) is one such technique presented at LDTA 2009.  It&#039;s basically just recursive-descent, except that it can handle multiple simultaneous parse trails.  And, as with recursive-descent, it is extremely amenable to representation within a functional, composable framework (like parser combinators).  In other words, you get all of the benefits of a true, generalized parsing algorithm, cubic performance in the worst case with linear performance on most grammars, all within the easy-to-use framework of parser combinators.  Share and enjoy: http://github.com/djspiewak/gll-combinators</description>
		<content:encoded><![CDATA[<p>@gatoatigrado</p>
<p>GLR is interesting, but it has some fairly serious flaws.  For example, despite Tomita&#8217;s claims, the algorithm is not O(n^3) in the worst case.  This grammar in particular is O(n^4) for all valid input:</p>
<pre>
S ::= S S
    | S S S
    | b
</pre>
<p>Also, GLR is not fully generalized.  There are grammars for which GLR (as with any shift-reduce parsing technique) is undefined:</p>
<pre>
A ::= B A a
    | a

B ::= \epsilon
</pre>
<p>Granted, most GLR parser generators will transform the above grammar into something which is actually usable within the constraints of the algorithm, but it doesn&#8217;t change the fact that GLR is not entirely what it claims to be.</p>
<p>Fortunately, there are algorithms which are fully-general and which attain cubic asymptotic bounds without absurd memory usage.  For example, GLL (Generalized LL) is one such technique presented at LDTA 2009.  It&#8217;s basically just recursive-descent, except that it can handle multiple simultaneous parse trails.  And, as with recursive-descent, it is extremely amenable to representation within a functional, composable framework (like parser combinators).  In other words, you get all of the benefits of a true, generalized parsing algorithm, cubic performance in the worst case with linear performance on most grammars, all within the easy-to-use framework of parser combinators.  Share and enjoy: <a href="http://github.com/djspiewak/gll-combinators" rel="nofollow">http://github.com/djspiewak/gll-combinators</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: gatoatigrado</title>
		<link>http://www.codecommit.com/blog/scala/the-magic-behind-parser-combinators/comment-page-1#comment-4871</link>
		<dc:creator>gatoatigrado</dc:creator>
		<pubDate>Fri, 31 Jul 2009 08:00:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.codecommit.com/blog/scala/the-magic-behind-parser-combinators#comment-4871</guid>
		<description>unfortunately, most of the regex libraries used are the unintuitive, potentially exponential time (or worse) backtracking Perl libraries. It&#039;s a nice idea in theory. I think the research in Elkhound is the nicest technology -- a GLR parser that runs as fast as LALR on most inputs. Unfortunately the implementation is c++ and rather geared towards parsing c++ (which demonstrates that it can tackle challenging grammars, but doesn&#039;t so much make it accessible for small languages).</description>
		<content:encoded><![CDATA[<p>unfortunately, most of the regex libraries used are the unintuitive, potentially exponential time (or worse) backtracking Perl libraries. It&#8217;s a nice idea in theory. I think the research in Elkhound is the nicest technology &#8212; a GLR parser that runs as fast as LALR on most inputs. Unfortunately the implementation is c++ and rather geared towards parsing c++ (which demonstrates that it can tackle challenging grammars, but doesn&#8217;t so much make it accessible for small languages).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nathan Matthews</title>
		<link>http://www.codecommit.com/blog/scala/the-magic-behind-parser-combinators/comment-page-1#comment-4869</link>
		<dc:creator>Nathan Matthews</dc:creator>
		<pubDate>Wed, 29 Jul 2009 21:13:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.codecommit.com/blog/scala/the-magic-behind-parser-combinators#comment-4869</guid>
		<description>Hi Daniel,

I&#039;ve stumbled across your blog. I just want to say thank you, you have a great writing style and the content is hugely informative.  I&#039;m trying to learn Scala better and because the language is so grand in scope and capability it can be hard getting started. I know how much time it takes to write quality material. Anyways, thanks again.</description>
		<content:encoded><![CDATA[<p>Hi Daniel,</p>
<p>I&#8217;ve stumbled across your blog. I just want to say thank you, you have a great writing style and the content is hugely informative.  I&#8217;m trying to learn Scala better and because the language is so grand in scope and capability it can be hard getting started. I know how much time it takes to write quality material. Anyways, thanks again.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daniel Spiewak</title>
		<link>http://www.codecommit.com/blog/scala/the-magic-behind-parser-combinators/comment-page-1#comment-4826</link>
		<dc:creator>Daniel Spiewak</dc:creator>
		<pubDate>Mon, 13 Apr 2009 14:49:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.codecommit.com/blog/scala/the-magic-behind-parser-combinators#comment-4826</guid>
		<description>@Walter

Whitespace and comments are actually a trickier issue.  My personal preference on handling them is to first feed the input source through a proper scanner, which then produces tokens and removes all unnecessary whitespace (and comments).  Parser combinators are certainly compatible with this technique, but for some reason it is rarely employed.

In order to implement whitespace-stripping in my parsers, I would have to do something similar to what RegexParsers does in the Scala combinator framework, which is basically pre-process the stream before every parser, stripping any leading whitespace.  Comments can be handled in the same pass.</description>
		<content:encoded><![CDATA[<p>@Walter</p>
<p>Whitespace and comments are actually a trickier issue.  My personal preference on handling them is to first feed the input source through a proper scanner, which then produces tokens and removes all unnecessary whitespace (and comments).  Parser combinators are certainly compatible with this technique, but for some reason it is rarely employed.</p>
<p>In order to implement whitespace-stripping in my parsers, I would have to do something similar to what RegexParsers does in the Scala combinator framework, which is basically pre-process the stream before every parser, stripping any leading whitespace.  Comments can be handled in the same pass.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Walter Chang</title>
		<link>http://www.codecommit.com/blog/scala/the-magic-behind-parser-combinators/comment-page-1#comment-4825</link>
		<dc:creator>Walter Chang</dc:creator>
		<pubDate>Mon, 13 Apr 2009 09:34:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.codecommit.com/blog/scala/the-magic-behind-parser-combinators#comment-4825</guid>
		<description>thanks for the great article!  just curious, how are whitespaces handled in your parsers?  what would be best strategy to handle whitespaces and comments?</description>
		<content:encoded><![CDATA[<p>thanks for the great article!  just curious, how are whitespaces handled in your parsers?  what would be best strategy to handle whitespaces and comments?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Fabien Todescato</title>
		<link>http://www.codecommit.com/blog/scala/the-magic-behind-parser-combinators/comment-page-1#comment-4814</link>
		<dc:creator>Fabien Todescato</dc:creator>
		<pubDate>Wed, 01 Apr 2009 09:43:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.codecommit.com/blog/scala/the-magic-behind-parser-combinators#comment-4814</guid>
		<description>Hi Daniel, thanks for that great post. Parser combinators are indeed an impressive example of functional programming techniques.

A while ago, I had the opportunity to use in a few professional projects the Clean functional programming language (http://clean.cs.ru.nl/), which is a close cousin to Haskell. I used monadic parser combinators a lot, and found the following paper to be a nice introductory text, as well as an illustration of the use of more advanced techniques focused on efficency. The paper demonstrates the use of continuations to improve the execution efficiency of parser combinators.

P. Koopman and M.J. Plasmeijer. Efficient  Combinator Parsers, In Proc. of Implementation of Functional Languages (IFL  &#039;98), London, UK, K. Hammond, A.J.T. Davie and C. Clack (Eds.), Springer Verlag,  LNCS 1595, pp. 120-136. 

http://www.st.cs.ru.nl/papers/1999/koop98-EffCombParsIFL98.ps.gz

As Clean isa lazy functional programming language, which supports tail recursion, I am not sure these techniques do apply to Scala, but you may find the paper interesting nevertheless.</description>
		<content:encoded><![CDATA[<p>Hi Daniel, thanks for that great post. Parser combinators are indeed an impressive example of functional programming techniques.</p>
<p>A while ago, I had the opportunity to use in a few professional projects the Clean functional programming language (<a href="http://clean.cs.ru.nl/" rel="nofollow">http://clean.cs.ru.nl/</a>), which is a close cousin to Haskell. I used monadic parser combinators a lot, and found the following paper to be a nice introductory text, as well as an illustration of the use of more advanced techniques focused on efficency. The paper demonstrates the use of continuations to improve the execution efficiency of parser combinators.</p>
<p>P. Koopman and M.J. Plasmeijer. Efficient  Combinator Parsers, In Proc. of Implementation of Functional Languages (IFL  &#8216;98), London, UK, K. Hammond, A.J.T. Davie and C. Clack (Eds.), Springer Verlag,  LNCS 1595, pp. 120-136. </p>
<p><a href="http://www.st.cs.ru.nl/papers/1999/koop98-EffCombParsIFL98.ps.gz" rel="nofollow">http://www.st.cs.ru.nl/papers/1999/koop98-EffCombParsIFL98.ps.gz</a></p>
<p>As Clean isa lazy functional programming language, which supports tail recursion, I am not sure these techniques do apply to Scala, but you may find the paper interesting nevertheless.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
