<?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>Mon, 09 Jan 2012 20:21:24 -0800</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Shelby Moore III</title>
		<link>http://www.codecommit.com/blog/scala/the-magic-behind-parser-combinators/comment-page-1#comment-5254</link>
		<dc:creator>Shelby Moore III</dc:creator>
		<pubDate>Sat, 15 Jan 2011 10:23:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.codecommit.com/blog/scala/the-magic-behind-parser-combinators#comment-5254</guid>
		<description>http://en.wikipedia.org/w/index.php?title=Recursive_descent_parser&amp;oldid=407998337#Shortcomings

In the general case, recursive descent parsers are not limited to the Context-free grammar and thus do no global search for ambiguities in the LL(k) parsing First_k and Follow_k sets. Thus ambiguities are not known until run-time if and until the input triggers them. Such ambiguities where the recursive descent parser defaults (perhaps unknown to the grammar designer) to one of the possible ambiguous paths, thus results in semantic confusion (aliasing) in the use of the language, and leads to bugs by users of ambiguous programming languages which are not reported at compile-time, and which are introduced not by human error, but by ambiguous grammar. The only solution which eliminates these bugs, is to remove the ambiguities and use a Context-free grammar.

http://en.wikipedia.org/w/index.php?title=Parser_combinator&amp;oldid=407998210#Shortcomings_and_solutions

Parser combinators, like all recursive descent parsers, are not limited to the Context-free grammar and thus do no global search for ambiguities in the LL(k) parsing First_k and Follow_k sets. Thus ambiguities are not known until run-time if and until the input triggers them. Such ambiguities where the recursive descent parser defaults (perhaps unknown to the grammar designer) to one of the possible ambiguous paths, thus results in semantic confusion (aliasing) in the use of the language, and leads to bugs by users of ambiguous programming languages which are not reported at compile-time, and which are introduced not by human error, but by ambiguous grammar. The only solution which eliminates these bugs, is to remove the ambiguities and use a Context-free grammar.</description>
		<content:encoded><![CDATA[<p><a href="http://en.wikipedia.org/w/index.php?title=Recursive_descent_parser&amp;oldid=407998337#Shortcomings" rel="nofollow">http://en.wikipedia.org/w/index.php?title=Recursive_descent_parser&amp;oldid=407998337#Shortcomings</a></p>
<p>In the general case, recursive descent parsers are not limited to the Context-free grammar and thus do no global search for ambiguities in the LL(k) parsing First_k and Follow_k sets. Thus ambiguities are not known until run-time if and until the input triggers them. Such ambiguities where the recursive descent parser defaults (perhaps unknown to the grammar designer) to one of the possible ambiguous paths, thus results in semantic confusion (aliasing) in the use of the language, and leads to bugs by users of ambiguous programming languages which are not reported at compile-time, and which are introduced not by human error, but by ambiguous grammar. The only solution which eliminates these bugs, is to remove the ambiguities and use a Context-free grammar.</p>
<p><a href="http://en.wikipedia.org/w/index.php?title=Parser_combinator&amp;oldid=407998210#Shortcomings_and_solutions" rel="nofollow">http://en.wikipedia.org/w/index.php?title=Parser_combinator&amp;oldid=407998210#Shortcomings_and_solutions</a></p>
<p>Parser combinators, like all recursive descent parsers, are not limited to the Context-free grammar and thus do no global search for ambiguities in the LL(k) parsing First_k and Follow_k sets. Thus ambiguities are not known until run-time if and until the input triggers them. Such ambiguities where the recursive descent parser defaults (perhaps unknown to the grammar designer) to one of the possible ambiguous paths, thus results in semantic confusion (aliasing) in the use of the language, and leads to bugs by users of ambiguous programming languages which are not reported at compile-time, and which are introduced not by human error, but by ambiguous grammar. The only solution which eliminates these bugs, is to remove the ambiguities and use a Context-free grammar.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shelby Moore III</title>
		<link>http://www.codecommit.com/blog/scala/the-magic-behind-parser-combinators/comment-page-1#comment-5253</link>
		<dc:creator>Shelby Moore III</dc:creator>
		<pubDate>Sat, 15 Jan 2011 09:37:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.codecommit.com/blog/scala/the-magic-behind-parser-combinators#comment-5253</guid>
		<description>Also just because the time spent of compilation semantic analysis of the AST is often much greater than the time spent in the parser stage, the speed of the parser stage is very important for JIT compilation/interpreter.

Also I had looked at the recursive descent algorithms option and rejected it objectively.

The speedup in development time from not finding ambiguities will not make ambiguities disappear, because the grammar would still be ambiguous otherwise (backtracing makes a grammar ambiguous except in rare cases), and ambiguity results in semantic inconsistencies in the language, which get borne out as needless programming bugs that waste the hours of every programmer using the language. I have numerous examples of resolved issues at my Google code tracker for Copute.

So that speed up in development effort incurs a cost that is going to paid (probably more excruciatingly) down the line.</description>
		<content:encoded><![CDATA[<p>Also just because the time spent of compilation semantic analysis of the AST is often much greater than the time spent in the parser stage, the speed of the parser stage is very important for JIT compilation/interpreter.</p>
<p>Also I had looked at the recursive descent algorithms option and rejected it objectively.</p>
<p>The speedup in development time from not finding ambiguities will not make ambiguities disappear, because the grammar would still be ambiguous otherwise (backtracing makes a grammar ambiguous except in rare cases), and ambiguity results in semantic inconsistencies in the language, which get borne out as needless programming bugs that waste the hours of every programmer using the language. I have numerous examples of resolved issues at my Google code tracker for Copute.</p>
<p>So that speed up in development effort incurs a cost that is going to paid (probably more excruciatingly) down the line.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shelby Moore III</title>
		<link>http://www.codecommit.com/blog/scala/the-magic-behind-parser-combinators/comment-page-1#comment-5252</link>
		<dc:creator>Shelby Moore III</dc:creator>
		<pubDate>Sat, 15 Jan 2011 09:20:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.codecommit.com/blog/scala/the-magic-behind-parser-combinators#comment-5252</guid>
		<description>One major problem with recursive descent algorithms, such as parser combinators, is they do not do a LL(k) global search for First_k and Follow_k sets ambiguities at parser generation time. You won&#039;t actually know you have an ambiguity if and until you encounter it in the input at runtime. This is quite critical for developing a language:

http://members.cox.net/slkpg/documentation.html#SLK_FAQ

In the development of Copute&#039;s grammar, I found critical ambiguities that would have not been evident if I had gone with parser combinators (aka recursive descent algorithms). The tsuris I encountered in resolving ambiguities was due to incorrect grammar.

Also they will never be as faster, because for the k lookahead conflicts, they follow unnecessary paths, because the global optimization (look ahead tables) was not done.

I don&#039;t see what is the benefit? Perhaps it is just that the LL(k) parser generation tools are not written in good functional programming style in modern languages, thus making them difficult to adapt to and bootstrap in your new language.</description>
		<content:encoded><![CDATA[<p>One major problem with recursive descent algorithms, such as parser combinators, is they do not do a LL(k) global search for First_k and Follow_k sets ambiguities at parser generation time. You won&#8217;t actually know you have an ambiguity if and until you encounter it in the input at runtime. This is quite critical for developing a language:</p>
<p><a href="http://members.cox.net/slkpg/documentation.html#SLK_FAQ" rel="nofollow">http://members.cox.net/slkpg/documentation.html#SLK_FAQ</a></p>
<p>In the development of Copute&#8217;s grammar, I found critical ambiguities that would have not been evident if I had gone with parser combinators (aka recursive descent algorithms). The tsuris I encountered in resolving ambiguities was due to incorrect grammar.</p>
<p>Also they will never be as faster, because for the k lookahead conflicts, they follow unnecessary paths, because the global optimization (look ahead tables) was not done.</p>
<p>I don&#8217;t see what is the benefit? Perhaps it is just that the LL(k) parser generation tools are not written in good functional programming style in modern languages, thus making them difficult to adapt to and bootstrap in your new language.</p>
]]></content:encoded>
	</item>
	<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>
</channel>
</rss>

