<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Boost.Spirit</title>
	
	<link>http://boost-spirit.com/home</link>
	<description>Home of The Boost.Spirit Library</description>
	<lastBuildDate>Sat, 06 Apr 2013 04:04:22 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/Boost-Spirit" /><feedburner:info uri="boost-spirit" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Spirit X3 on Github</title>
		<link>http://feedproxy.google.com/~r/Boost-Spirit/~3/605b6mSRXwc/</link>
		<comments>http://boost-spirit.com/home/2013/02/23/spirit-x3-on-github/#comments</comments>
		<pubDate>Sun, 24 Feb 2013 03:19:52 +0000</pubDate>
		<dc:creator>Joel de Guzman</dc:creator>
				<category><![CDATA[C++Now 2013]]></category>
		<category><![CDATA[Spirit X3]]></category>

		<guid isPermaLink="false">http://boost-spirit.com/home/?p=1587</guid>
		<description><![CDATA[Oh, in case anyone wants to follow the development of X3, here are the Github links: https://github.com/djowel/spirit_x3 https://github.com/djowel/spirit_x3.git git@github.com:djowel/spirit_x3.git The full attribute mechanism works + basic C++lambda support. I&#8217;ve ported one example (calc4.cpp) which parses to an AST. The AST remains the same. Only the way the grammars are written had to change. For a [...]]]></description>
				<content:encoded><![CDATA[<p>Oh, in case anyone wants to follow the development of X3, here are the Github links:</p>
<blockquote><p><a href="https://github.com/djowel/spirit_x3">https://github.com/djowel/spirit_x3</a><br />
<a href="https://github.com/djowel/spirit_x3.git">https://github.com/djowel/spirit_x3.git</a><br />
<a href="git@github.com:djowel/spirit_x3.git">git@github.com:djowel/spirit_x3.git</a></p></blockquote>
<p>The full attribute mechanism works + basic C++lambda support. I&#8217;ve ported one example (calc4.cpp) which parses to an AST. The AST remains the same. Only the way the grammars are written had to change.</p>
<p>For a teaser: here&#8217;s GCC times:</p>
<p>SpiritX3: TOTAL :   4.27 secs<br />
Spirit2:  TOTAL :  10.00 secs</p>
<p>Even faster at CT than the first Spirit3 attempt. Runtime speed? I expect it to be faster than Spirit-2. The rules have changed (pun intentional). Now, there&#8217;s no longer the need for virtual functions and auto is used extensively. I expect code size to be smaller too because the compiler can generate more efficient code.</p>
<p>Here&#8217;s the calculator grammar (based on calc3.cpp):</p>
<pre class="brush: cpp; title: ; notranslate">
///////////////////////////////////////////////////////////////////////////////
//  The calculator grammar
///////////////////////////////////////////////////////////////////////////////
namespace calculator_grammar
{
    using x3::uint_;
    using x3::char_;

    x3::rule&lt;class expression, ast::program&gt; const expression;
    x3::rule&lt;class term, ast::program&gt; const term;
    x3::rule&lt;class factor, ast::operand&gt; const factor;

    auto const expression_def =
        term
        &gt;&gt; *(   (char_('+') &gt;&gt; term)
            |   (char_('-') &gt;&gt; term)
            )
        ;

    auto const term_def =
        factor
        &gt;&gt; *(   (char_('*') &gt;&gt; factor)
            |   (char_('/') &gt;&gt; factor)
            )
        ;

    auto const factor_def =
            uint_
        |   '(' &gt;&gt; expression &gt;&gt; ')'
        |   (char_('-') &gt;&gt; factor)
        |   (char_('+') &gt;&gt; factor)
        ;

    auto const calculator = x3::grammar(
            expression = expression_def,
            term = term_def,
            factor = factor_def
        );
}

using calculator_grammar::calculator;
</pre>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Boost-Spirit?a=605b6mSRXwc:MJtTq1fFhBQ:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Boost-Spirit?d=yIl2AUoC8zA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Boost-Spirit/~4/605b6mSRXwc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://boost-spirit.com/home/2013/02/23/spirit-x3-on-github/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://boost-spirit.com/home/2013/02/23/spirit-x3-on-github/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=spirit-x3-on-github</feedburner:origLink></item>
		<item>
		<title>Spirit X3</title>
		<link>http://feedproxy.google.com/~r/Boost-Spirit/~3/jtKU_kg8HKE/</link>
		<comments>http://boost-spirit.com/home/2013/02/23/spirit-x3/#comments</comments>
		<pubDate>Sun, 24 Feb 2013 00:33:01 +0000</pubDate>
		<dc:creator>Joel de Guzman</dc:creator>
				<category><![CDATA[C++Now 2013]]></category>
		<category><![CDATA[Spirit X3]]></category>

		<guid isPermaLink="false">http://boost-spirit.com/home/?p=1577</guid>
		<description><![CDATA[My proposal &#8220;Inside Spirit X3. Redesigning Boost.Spirit for C++11&#8243; has been accepted for presentation at the C++ Now! 2013 in Aspen Colorado. So after a 2 year hiatus, I&#8217;m back to Aspen. Here&#8217;s the abstract: Inside Spirit X3.Redesigning Boost.Spirit for C++11 Joel de Guzman, 2013 The hugely successful BoostCon &#8217;07 &#8217;08, &#8217;09 and &#8217;10 Spirit [...]]]></description>
				<content:encoded><![CDATA[<p style="text-align: left;">My proposal &#8220;Inside Spirit X3. Redesigning Boost.Spirit for C++11&#8243; has been accepted for presentation at the C++ Now! 2013 in Aspen Colorado. So after a 2 year hiatus, I&#8217;m back to Aspen.</p>
<p>Here&#8217;s the abstract:</p>
<blockquote><p><strong>Inside Spirit X3.</strong><em><strong>Redesigning Boost.Spirit for C++11<br />
</strong></em>Joel de Guzman, 2013</p>
<p>The hugely successful BoostCon &#8217;07 &#8217;08, &#8217;09 and &#8217;10 Spirit talks provided walk-through presentations and tutorials on how to use Spirit. This, time, I propose a presentation that will focus on the design and implementation of Spirit. But to add more to the thrill, I will present a major redesign of Spirit from the ground up, taking advantage of the new C++11 features. One important goal of this experimental version of Spirit (named X3) is to bring back the elegant simplicity of &#8220;Classic&#8221; Spirit, which was somehow lost with the complexity of Spirit-2 primarily due to the lack of important language features that are just starting to appear in C++ compilers. In this 90-minute presentation, I would like to get down and dirty with Modern C++11 code, and along the way, share my experience as well as expose some of C++11&#8242;s shortcomings and my wishes for C++1y.</p></blockquote>
<p>Hope to see you there!</p>
<p><img class="aligncenter" alt="" src="http://cppnow.org/files/2012/04/273902_web.jpg" width="377" height="248" /></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Boost-Spirit?a=jtKU_kg8HKE:e_2KiNz3azw:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Boost-Spirit?d=yIl2AUoC8zA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Boost-Spirit/~4/jtKU_kg8HKE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://boost-spirit.com/home/2013/02/23/spirit-x3/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://boost-spirit.com/home/2013/02/23/spirit-x3/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=spirit-x3</feedburner:origLink></item>
		<item>
		<title>Official Spirit IRC channel</title>
		<link>http://feedproxy.google.com/~r/Boost-Spirit/~3/ABoNiQe0fwA/</link>
		<comments>http://boost-spirit.com/home/2011/08/10/official-spirit-irc-channel/#comments</comments>
		<pubDate>Wed, 10 Aug 2011 19:40:14 +0000</pubDate>
		<dc:creator>Joel de Guzman</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://boost-spirit.com/home/?p=1549</guid>
		<description><![CDATA[We&#8217;ve had a Spirit IRC channel for a few months now. It started out as a semi-private channel. Well, we made it officially public now. You can get Spirit support via the ##spirit or #boost IRC channels at freenode, where you will often find knowledgeable people willing to help with your Spirit questions. The #boost [...]]]></description>
				<content:encoded><![CDATA[<p>We&#8217;ve had a Spirit IRC channel for a few months now. It started out as a semi-private channel. Well, we made it officially public now. You can get Spirit support via the ##spirit or #boost IRC channels at freenode, where you will often find knowledgeable people willing to help with your Spirit questions. The #boost channel is for anything Boost related, including Spirit. The ##spirit channel is solely for Spirit and Spirit related libraries (Fusion, Phoenix and Wave).</p>
<p>See you there!</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Boost-Spirit?a=ABoNiQe0fwA:e0a5S_5QJcM:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Boost-Spirit?d=yIl2AUoC8zA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Boost-Spirit/~4/ABoNiQe0fwA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://boost-spirit.com/home/2011/08/10/official-spirit-irc-channel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://boost-spirit.com/home/2011/08/10/official-spirit-irc-channel/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=official-spirit-irc-channel</feedburner:origLink></item>
		<item>
		<title>10 Years of Spirit</title>
		<link>http://feedproxy.google.com/~r/Boost-Spirit/~3/Ob1gpdUNcLQ/</link>
		<comments>http://boost-spirit.com/home/2011/07/24/10-years-of-spirit/#comments</comments>
		<pubDate>Mon, 25 Jul 2011 00:39:08 +0000</pubDate>
		<dc:creator>Joel de Guzman</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://boost-spirit.com/home/?p=1522</guid>
		<description><![CDATA[Spirit is 10 years old! It&#8217;s hard to pinpoint exactly the birthday of Spirit. Looking back, Spirit 1.0 which was uploaded to SourceForge in July 27, 2001 contains this comment in its main header file: 8/28/1999    Original Implementation [ run time polymorphic version ] (JDG) 4/30/2001    Template meta-programming implementation (JDG) 5/13/2001    Major redesign using iterators [...]]]></description>
				<content:encoded><![CDATA[<h3>Spirit is 10 years old!</h3>
<p>It&#8217;s hard to pinpoint exactly the birthday of Spirit. Looking back, <a title="Spirit 1.0" href="http://sourceforge.net/projects/spirit/files/spirit/1.0/">Spirit 1.0 which was uploaded to SourceForge</a> in July 27, 2001 contains this comment in its main header file:</p>
<blockquote><p>8/28/1999    Original Implementation [ run time polymorphic version ] (JDG)<br />
4/30/2001    Template meta-programming implementation (JDG)<br />
5/13/2001    Major redesign using iterators (JDG)<br />
5/26/2001    Port to G++3.0 and BCC 5.5.1 thanks to Vladimir Prus<br />
5/27/2001    Bug fixes in Difference and Xor classes (JDG)<br />
5/30/2001    Added Iterators (JDG)</p></blockquote>
<p><span id="more-1522"></span></p>
<p>And then, there&#8217;s the original post to Boost developer&#8217;s list dated May 21, 2001:</p>
<blockquote><p>Hello there,</p>
<p>Spirit is an object oriented recursive descent parser generator framework implemented using template meta-programming techniques. Expression templates allow us to approximate the syntax of Extended Backus Normal Form (EBNF) completely in C++. The Spirit framework enables a target grammar to be written exclusively in C++. EBNF grammar specifications can mix freely with other C++ code and, thanks to the generative power of C++ templates, are immediately executable. In retrospect, conventional compiler-compilers or parser-generators have to perform an additional translation step from the source EBNF code to C or C++ code.</p>
<p>The documentation and source code can be found at http://isis-tech.n3.net. I would appreciate feedback and comments.</p>
<p>Joel de Guzman</p></blockquote>
<p>Let me declare that the July 27, 2001 SF upload should mark Spirit&#8217;s birthday. That&#8217;ll be 3 days from now.</p>
<p><strong>Happy 10 years, Spirit!</strong></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Boost-Spirit?a=Ob1gpdUNcLQ:uepXP2_MpFY:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Boost-Spirit?d=yIl2AUoC8zA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Boost-Spirit/~4/Ob1gpdUNcLQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://boost-spirit.com/home/2011/07/24/10-years-of-spirit/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		<feedburner:origLink>http://boost-spirit.com/home/2011/07/24/10-years-of-spirit/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=10-years-of-spirit</feedburner:origLink></item>
		<item>
		<title>How to Optimize Qi</title>
		<link>http://feedproxy.google.com/~r/Boost-Spirit/~3/b9oocTwvuBo/</link>
		<comments>http://boost-spirit.com/home/2011/07/23/how-to-optimize-qi/#comments</comments>
		<pubDate>Sat, 23 Jul 2011 15:49:28 +0000</pubDate>
		<dc:creator>Hartmut Kaiser</dc:creator>
				<category><![CDATA[Qi Example]]></category>
		<category><![CDATA[User Experience]]></category>
		<category><![CDATA[Qi]]></category>

		<guid isPermaLink="false">http://boost-spirit.com/home/2011/07/23/how-to-optimize-qi/</guid>
		<description><![CDATA[Mike Lewis posted a marvelous experience report dubbed ‘Optimizing Boost Spirit &#8211; Blazing fast AST generation using boost::spirit’. He describes how he took an old compiler for the Epoch programming language (which was based on Spirit.Classic) and tuned it for performance using Spirit.Qi and Spirit.Lex. His results are exceptional, he got roughly a thousand fold [...]]]></description>
				<content:encoded><![CDATA[<p>Mike Lewis posted a marvelous experience report dubbed ‘<a href="http://code.google.com/p/scribblings-by-apoch/wiki/OptimizingBoostSpirit" target="_blank">Optimizing Boost Spirit &#8211; Blazing fast AST generation using boost::spirit</a><em>’.</em> He describes how he took an old compiler for the <a href="http://code.google.com/p/epoch-language/" target="_blank">Epoch</a> programming language (which was based on S<em>pirit.Classic)</em> and tuned it for performance using <em>Spirit.Qi</em> and <em>Spirit.Lex</em>. His results are exceptional, he got roughly a thousand fold speedup compared to the old version. The complete code for his compiler can be downloaded from <a href="http://code.google.com/p/epoch-language/source/browse/" target="_blank">here</a>.</p>
<p><span id="more-1519"></span></p>
<p>He writes:</p>
<blockquote><p>This code illustrates several advanced techniques for parsing large inputs with complex Spirit grammars:</p>
<ul>
<li>Deferred construction and minimal copying of attribute values</li>
<li>Lexical analysis for faster backtracking</li>
<li>A special directive for using qi::symbols alongside a lexer</li>
<li>Linear allocators for faster AST node allocation</li>
<li>Intrusive reference counting for even faster AST node allocation/copying</li>
<li>Grammar transformations for general optimality</li>
<li>Abuse of the &amp;-predicate for skipping expensive productions</li>
<li>Dividing grammars into multiple implementation files for minimal recompilation times</li>
</ul>
</blockquote>
<p>Thanks Mike for sharing your work! I’m sure many <em>Spirit</em> developers will find it very enlightening and encouraging to read about your work. Keep up the excellent work!</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Boost-Spirit?a=b9oocTwvuBo:KnX-vivGaPw:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Boost-Spirit?d=yIl2AUoC8zA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Boost-Spirit/~4/b9oocTwvuBo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://boost-spirit.com/home/2011/07/23/how-to-optimize-qi/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://boost-spirit.com/home/2011/07/23/how-to-optimize-qi/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=how-to-optimize-qi</feedburner:origLink></item>
		<item>
		<title>Spirit V2.5 has been released!</title>
		<link>http://feedproxy.google.com/~r/Boost-Spirit/~3/E9izlxbPKZQ/</link>
		<comments>http://boost-spirit.com/home/2011/07/12/spirit-v2-5-has-been-released/#comments</comments>
		<pubDate>Tue, 12 Jul 2011 18:19:05 +0000</pubDate>
		<dc:creator>Hartmut Kaiser</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Karma]]></category>
		<category><![CDATA[Lex]]></category>
		<category><![CDATA[Qi]]></category>

		<guid isPermaLink="false">http://boost-spirit.com/home/2011/07/12/spirit-v2-5-has-been-released/</guid>
		<description><![CDATA[Spirit V2.5 is now available as part of the recently released Boost V1.47. I suggest you look at the What&#8217;s New documentation page for a list of things changed. This is a very important release for Spirit, mostly in the area of feature consolidation and less so by adding new functionality. It brings a lot [...]]]></description>
				<content:encoded><![CDATA[<p>Spirit V2.5 is now available as part of the recently released Boost V1.47. I suggest you look at the <a href="http://www.boost.org/doc/libs/1_47_0/libs/spirit/doc/html/spirit/what_s_new/spirit_2_5.html">What&#8217;s New</a> documentation page for a list of things changed. This is a very important release for Spirit, mostly in the area of feature consolidation and less so by adding new functionality. It brings a lot of unification and quite some speedup in the area of attribute handling, both for parsers (<em>Qi</em>) and generators (<em>Karma</em>). Most of the newly added features are in the area of unification of the overall user experience as well. The things added to the <em>Lexer</em> should finally resolve some long standing requests. Most importantly, we are very excited about having added full compatibility with the newly released Phoenix V3 library.</p>
<p>Generally, all changes are supposed to be fully backwards compatible. If you run into problems with your existing code, please tell us by leaving a comment or by sending a message to the Spirit mailing list (as described on our <a href="http://boost-spirit.com/home/feedback-and-support/">Support</a> page).</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Boost-Spirit?a=E9izlxbPKZQ:X2Q3YQO9fkI:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Boost-Spirit?d=yIl2AUoC8zA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Boost-Spirit/~4/E9izlxbPKZQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://boost-spirit.com/home/2011/07/12/spirit-v2-5-has-been-released/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://boost-spirit.com/home/2011/07/12/spirit-v2-5-has-been-released/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=spirit-v2-5-has-been-released</feedburner:origLink></item>
		<item>
		<title>AST Construction with the Universal Tree</title>
		<link>http://feedproxy.google.com/~r/Boost-Spirit/~3/E5UO5Pm-Ups/</link>
		<comments>http://boost-spirit.com/home/2011/06/12/ast-construction-with-the-universal-tree/#comments</comments>
		<pubDate>Sun, 12 Jun 2011 14:54:48 +0000</pubDate>
		<dc:creator>Joel de Guzman</dc:creator>
				<category><![CDATA[Boost Con 2011]]></category>
		<category><![CDATA[BoostCon]]></category>

		<guid isPermaLink="false">http://boost-spirit.com/home/?p=1508</guid>
		<description><![CDATA[Here&#8217;s another cool Spirit talk. This time from Bryce Alexander Lelbach: http://blip.tv/boostcon/ast-construction-with-the-universal-tree-5266608 utree, a recent addition to the Boost.Spirit codebase, is a generic data structure designed to represent abstract syntax trees. Bindings to Qi and Karma make utree a powerful tool for parser and generator development with Boost.Spirit. This presentation would demonstrate the usage of [...]]]></description>
				<content:encoded><![CDATA[<p>Here&#8217;s another cool Spirit talk. This time from Bryce Alexander Lelbach:</p>
<p><a href="http://blip.tv/boostcon/ast-construction-with-the-universal-tree-5266608">http://blip.tv/boostcon/ast-construction-with-the-universal-tree-5266608</a></p>
<blockquote><p>utree, a recent addition to the Boost.Spirit codebase, is a generic data  structure designed to represent abstract syntax trees. Bindings to Qi  and Karma make utree a powerful tool for parser and generator  development with Boost.Spirit. This presentation would demonstrate the  usage of utree and Spirit to build and manipulate an abstract syntax  tree for four parsing/generating use cases: XML, symbolic expressions,  JSON, and C-like source code. The details of utree’s integration with  Spirit and their implications for writing utree-centric Spirit parsers  and generators would be discussed. Additionally, design patterns for  compiling a utree AST to other internal representations (DOM tree for  XML, function tree for a Scheme-like language for symbolic expressions,  associative arrays for JSON objects, a simple VM bytecode for mini-C  source code) would be covered.</p></blockquote>
<p>Here are the slides:</p>
<p><a href="https://github.com/boostcon/2011_presentations/raw/master/fri/utree_talk.pdf">https://github.com/boostcon/2011_presentations/raw/master/fri/utree_talk.pdf</a></p>
<p>&nbsp;</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Boost-Spirit?a=E5UO5Pm-Ups:gHFSX6oT7QI:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Boost-Spirit?d=yIl2AUoC8zA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Boost-Spirit/~4/E5UO5Pm-Ups" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://boost-spirit.com/home/2011/06/12/ast-construction-with-the-universal-tree/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		<feedburner:origLink>http://boost-spirit.com/home/2011/06/12/ast-construction-with-the-universal-tree/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=ast-construction-with-the-universal-tree</feedburner:origLink></item>
		<item>
		<title>Phoenix V3 – An Overview</title>
		<link>http://feedproxy.google.com/~r/Boost-Spirit/~3/ttdx5wkZ8xk/</link>
		<comments>http://boost-spirit.com/home/2011/06/08/phoenix-v3-%e2%80%93-an-overview/#comments</comments>
		<pubDate>Wed, 08 Jun 2011 21:36:05 +0000</pubDate>
		<dc:creator>Joel de Guzman</dc:creator>
				<category><![CDATA[Advanced]]></category>
		<category><![CDATA[Beginner]]></category>
		<category><![CDATA[Boost Con 2011]]></category>
		<category><![CDATA[BoostCon]]></category>
		<category><![CDATA[Experience Level]]></category>
		<category><![CDATA[Intermediate]]></category>
		<category><![CDATA[Phoenix]]></category>

		<guid isPermaLink="false">http://boost-spirit.com/home/?p=1498</guid>
		<description><![CDATA[Here&#8217;s another BoostCon video uploaded by Marshall Clow. This one is about Phoenix V3, by Hartmut Kaiser: http://blip.tv/boostcon/phoenix-v3-an-overview-5250984 The slides for this talk can be found here: https://github.com/boostcon/2011_presentations/blob/master/mon/phoenix_v3.pdf?raw=true. Phoenix will be the next generation of creating unnamed, inlined polymorphic function objects. With V3 we combine the functionality of Boost.Bind and Boost.Lambda, and arranges it into [...]]]></description>
				<content:encoded><![CDATA[<p>Here&#8217;s another BoostCon video uploaded by Marshall Clow. This one is about Phoenix V3, by Hartmut Kaiser:</p>
<p><a href="http://blip.tv/boostcon/phoenix-v3-an-overview-5250984">http://blip.tv/boostcon/phoenix-v3-an-overview-5250984</a></p>
<p>The slides for this talk can be found here: <a rel="nofollow" href="https://github.com/boostcon/2011_presentations/blob/master/mon/phoenix_v3.pdf?raw=true">https://github.com/boostcon/2011_presentations/blob/master/mon/phoenix_v3.pdf?raw=true</a>.</p>
<blockquote><p>Phoenix will be the next generation of creating unnamed, inlined  polymorphic function objects. With V3 we combine the functionality of  Boost.Bind and Boost.Lambda, and arranges it into a new library. By  writing this new library, we were able to fix some limitations of the  aforementioned libraries without breaking backwardscompatibility. The  purpose of the talk will be to outline the importance and elegance of  functional programming (FP) in C++. The first part of the talk will give  an introduction into the Domain Specific Embedded Language (DSEL) we  defined with Phoenix. A DSEL is built with the help of regular C++  function and operator overloads. For Phoenix we defined such a language  that emulates C++, to give potential users a low entry into the world of  FP. While a lot of existing C++ code relies on higher order functions  (better known as function objects), e.g. the C++ standard library use  them as a way to let users customize operations in certain algorithms.  We focus the second part of the talk on examples on how to use Phoenix  instead of writing regular function objects and how to enable your  legacy code to be used inside Phoenix expressions. However, Phoenix is  more. Phoenix is equipped with a unique (in C++) mechanism to handle the  expressions discussed in the previous sections as data. This allows us  to handle Phoenix not in the C++ standard way but in any way you like.  An overview of these mechanisms will be given in the last part of the  talk to give potential users an insight on possible future applications  that might evolve around Phoenix.</p></blockquote>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Boost-Spirit?a=ttdx5wkZ8xk:1o7Z7j7dBjM:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Boost-Spirit?d=yIl2AUoC8zA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Boost-Spirit/~4/ttdx5wkZ8xk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://boost-spirit.com/home/2011/06/08/phoenix-v3-%e2%80%93-an-overview/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://boost-spirit.com/home/2011/06/08/phoenix-v3-%e2%80%93-an-overview/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=phoenix-v3-%25e2%2580%2593-an-overview</feedburner:origLink></item>
		<item>
		<title>Spirit.Qi in the Real World</title>
		<link>http://feedproxy.google.com/~r/Boost-Spirit/~3/liHeFfmuYjU/</link>
		<comments>http://boost-spirit.com/home/2011/06/08/spirit-qi-in-the-real-world/#comments</comments>
		<pubDate>Wed, 08 Jun 2011 21:34:32 +0000</pubDate>
		<dc:creator>Joel de Guzman</dc:creator>
				<category><![CDATA[Beginner]]></category>
		<category><![CDATA[Boost Con 2011]]></category>
		<category><![CDATA[BoostCon]]></category>
		<category><![CDATA[Experience Level]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Intermediate]]></category>
		<category><![CDATA[Qi Example]]></category>
		<category><![CDATA[User Experience]]></category>
		<category><![CDATA[BoostCon 2011]]></category>

		<guid isPermaLink="false">http://boost-spirit.com/home/?p=1496</guid>
		<description><![CDATA[This is the first time I missed attending BoostCon (May 15-20, 2011 – Aspen, Colorado). Fortunately, for us who were not able to attend, Marshall Clow uploaded some videos. Here&#8217;s one one that&#8217;s relevant to Spirit: &#8220;Spirit.Qi in the Real World&#8221;, by Robert Stewart. Watch the presentation here: http://blip.tv/boostcon/spirit-qi-in-the-real-world-5254335 You can find the slides here: [...]]]></description>
				<content:encoded><![CDATA[<p>This is the first time I missed attending BoostCon (May 15-20, 2011 – Aspen, Colorado). Fortunately, for us who were not able to attend, Marshall Clow uploaded some videos. Here&#8217;s one one that&#8217;s relevant to Spirit: &#8220;Spirit.Qi in the Real World&#8221;, by Robert Stewart. Watch the presentation here:</p>
<p><a href="http://blip.tv/boostcon/spirit-qi-in-the-real-world-5254335">http://blip.tv/boostcon/spirit-qi-in-the-real-world-5254335</a></p>
<p>You can find the slides here: <a rel="nofollow" href="https://github.com/boostcon/2011_presentations/raw/master/tue/spirit_qi_in_the_real_world.pdf">https://github.com/boostcon/2011_presentations/raw/master/tue/spirit_qi_in_the_real_world.pdf</a></p>
<blockquote><p>Past sessions on Spirit have focused on introducing Spirit or showing  extracts of real use, intermingled with tutorial highlights. Upon  writing real Spirit.Qi parsers, however, one quickly discovers that &#8220;the  devil is in the details.&#8221; There are special cases, tricks, and idioms  that one must discover by trial and error or, perhaps, by following the  Spirit mailing list, all of which take time and may not be convenient.  In this session, we’ll walk through the development of a Spirit.Qi  parser for printf()-style format strings. The result will be a  replacement for printf() that is typesafe and efficient.</p></blockquote>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Boost-Spirit?a=liHeFfmuYjU:BPVjGRbz-wU:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Boost-Spirit?d=yIl2AUoC8zA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Boost-Spirit/~4/liHeFfmuYjU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://boost-spirit.com/home/2011/06/08/spirit-qi-in-the-real-world/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://boost-spirit.com/home/2011/06/08/spirit-qi-in-the-real-world/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=spirit-qi-in-the-real-world</feedburner:origLink></item>
		<item>
		<title>The Keyword parser</title>
		<link>http://feedproxy.google.com/~r/Boost-Spirit/~3/DG93HWmk4I0/</link>
		<comments>http://boost-spirit.com/home/2011/04/16/the-keyword-parser/#comments</comments>
		<pubDate>Sat, 16 Apr 2011 17:27:14 +0000</pubDate>
		<dc:creator>teajay</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Qi Example]]></category>

		<guid isPermaLink="false">http://boost-spirit.com/home/?p=1416</guid>
		<description><![CDATA[The keyword parser construct has recently been added to spirit&#8217;s repository (available in 1.47 or from svn) . Here&#8217;s a small introduction to help you get started using the keyword parsers. Those of you familiar with the Nabialek trick will recognize it&#8217;s working under the hood. What you can achieve with the keywords parser can [...]]]></description>
				<content:encoded><![CDATA[<p>The keyword parser construct has recently been added to <a href="https://svn.boost.org/svn/boost/trunk/libs/spirit/repository/doc/html/index.html" target="_blank">spirit&#8217;s repository</a> (available in 1.47 or from svn) . Here&#8217;s a small introduction to help you get started using the keyword parsers.</p>
<p>Those of you familiar with the <a title="Nabialek trick" href="http://boost-spirit.com/home/articles/qi-example/nabialek-trick/" target="_blank">Nabialek trick </a>will recognize it&#8217;s working under the hood. What you can achieve with the keywords parser can also be achieved with the Nabialek trick but not always as elegantly or as efficiently.</p>
<p><span id="more-1416"></span></p>
<p>The two examples presented below are included in the spirit repository and can be found in the folder :</p>
<pre class="brush: plain; title: ; notranslate">libs/spirit/repository/example/qi</pre>
<h4>Data members marked by keywords (<a href="https://svn.boost.org/svn/boost/trunk/libs/spirit/repository/example/qi/options.cpp" target="_blank">options.cpp</a>)</h4>
<p>For this small introduction we&#8217;ll consider parsing a program command line.</p>
<p>Options are commonly passed to applications delimited by option keywords :</p>
<pre class="brush: plain; title: ; notranslate">

mySuperCompiler --include includePath --define newSymbol=10 --output output.txt --define newSymbol2=20 --source mySourceFile

</pre>
<p>The order in which the options are specified doesn&#8217;t matter at all. The task of the parser we are going to write is to extract the individual options into some internal data structure we will use to control the program.</p>
<p>Here are the structures we could use to hold the options passed to our command line :</p>
<pre class="brush: cpp; title: ; notranslate">
// A basic preprocessor symbol&lt;/pre&gt;
typedef std::pair&lt;std::string, int32_t&gt; preprocessor_symbol;

struct program_options {
   // symbol container type definition
   typedef std::vector&lt; preprocessor_symbol &gt; preprocessor_symbols_container;&lt;/pre&gt;
   // include paths
   std::vector&lt;std::string&gt; includes;
   // preprocessor symbols
   preprocessor_symbols_container preprocessor_symbols;
   // output file name
   boost::optional&lt;std::string&gt; output_filename;
   // input file name
   std::string source_filename;
};

</pre>
<p>Of course  the structures are adapted to be compatible with fusion in order to get the data pulled into the structures easily.</p>
<p>Now lets define our options rule:</p>
<pre class="brush: cpp; title: ; notranslate">

rule&lt;const char *, program_options(), space_type&gt; kwd_rule;

kwd_rule %= kwd(&quot;--include&quot;)[
                parse_string
            ]
          / kwd(&quot;--define&quot;) [
                parse_string
                &gt;&gt; (
                    (lit('=') &gt; int_) | attr(1)
                   )
            ]
          / kwd(&quot;--output&quot;,0,1)[
                parse_string
            ]
          / kwd(&quot;--source&quot;,1)[
                parse_string
            ]
          ;
</pre>
<p>The first thing to notice here is that we used the %= operator. This means that the parsing construct we just wrote has an attribute type compatible with the attribute type of our adapted structure!</p>
<p>This is one spot were the keyword parsing construct surpasses the Nabialek trick. The Nabialek trick just can&#8217;t do that.</p>
<p>On the next lines we define our keyword parsing constructs.  Writing</p>
<pre class="brush: cpp; title: ; notranslate">kwd(&quot;--include&quot;)[ parse_string ] </pre>
<p>is equivalent to writing:</p>
<pre class="brush: cpp; title: ; notranslate">lit(&quot;--inlude&quot;) &gt; parse_string</pre>
<p>The word &#8220;&#8211;include&#8221; must be followed by a string.</p>
<p>The k<a title="kwd directive" href="http://svn.boost.org/svn/boost/trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/directives/kwd.html">wd directive</a> has the ability to be combined by using the <a title="Keyword list operator" href="http://svn.boost.org/svn/boost/trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/operators/keyword_list.html">/ operator</a>. The kwd directive and the operator / work tightly together to achive the goal of attribute compatibility while using the Nabialek trick.</p>
<p>One last thing to notice is the occurrence constraints which can be associated with a kwd directive. It works like the repeat directive and enables to add additional validation checks inside the keyword parsing loop.</p>
<p>Writing</p>
<pre class="brush: cpp; title: ; notranslate">kwd(&quot;--output&quot;,0,1)[ parse_string ] </pre>
<p>means that the keyword &#8220;&#8211;output&#8221; may occur 0 or 1 times at most. If it occurs more than once the parser will fail.</p>
<p>Writing</p>
<pre class="brush: cpp; title: ; notranslate">kwd(&quot;--source&quot;,1)[ parse_string ] </pre>
<p>means that the keyword &#8220;&#8211;source&#8221; must occur once and only once. This works just like the repeat directive.</p>
<p>Using occurrence constraints doesn&#8217;t cost much on the runtime performance and gives the ability to easily enforce constraints which would be otherwise way much more difficult to formulate.</p>
<p>The kwd directive also exists in a case insentive variant : ikwd. You can combine the kwd and ikwd freely inside the same keyword block at the cost of a small runtime overhead.</p>
<h4>Derived structures (<a href="https://svn.boost.org/svn/boost/trunk/libs/spirit/repository/example/qi/derived.cpp" target="_blank">derived.cpp</a>)</h4>
<p>A recent post in the mailing list gave me the idea to provide an example of how the keyword parser can be used to produce different derived structures depending on keywords placed in the input.</p>
<p>Here&#8217;s the problem as described by MM:</p>
<p>&#8220;I have a case where I have a prefix string that will distinguish what will follow it.</p>
<pre class="brush: plain; title: ; notranslate">prefix string - struct members</pre>
<p>this is what is read from the input stream. I have a base struct and 5 derived D1..D5, each derived has a different prefix as a static const std::string member. Parsing the prefix string tells me which struct D1..D5 I should parse after. All these derived structs are fusion adapted. There is a rule for each of the derived.&#8221;</p>
<p>To keep the example simple here are the classes we could consider:</p>
<pre class="brush: cpp; title: ; notranslate">

struct base_type {
    base_type(const std::string &amp;name) : name(name)  {}

    std::string name;
    virtual std::ostream &amp;output(std::ostream &amp;os) const {
        os&lt;&lt;&quot;Base : &quot;&lt;&lt;name;        return os;
    }
};

struct derived1 : public base_type {
    derived1(const std::string &amp;name, unsigned int data1) :
        base_type(name)
      , data1(data1)  {}

    unsigned int data1;
    virtual std::ostream &amp;output(std::ostream &amp;os) const {
        base_type::output(os);
        os&lt;&lt;&quot;, &quot;&lt;&lt;data1;
        return os;
    }
};

struct derived2 : public base_type {
    derived2(const std::string &amp;name, unsigned int data2) :
        base_type(name), data2(data2)  {}

    unsigned int data2;
    virtual std::ostream &amp;output(std::ostream &amp;os) const    {
        base_type::output(os);
        os&lt;&lt;&quot;, &quot;&lt;&lt;data2;
        return os;
    }
};

struct derived3 : public derived2 {
    derived3(const std::string &amp;name, unsigned int data2, double data3) :
      derived2(name,data2)
    , data3(data3)
    {}

    double data3;
    virtual std::ostream &amp;output(std::ostream &amp;os) const    {
        derived2::output(os);
        os&lt;&lt;&quot;, &quot;&lt;&lt;data3;
        return os;
    }
};

</pre>
<p>Our parse result must be a vector of pointers to our base class:</p>
<pre class="brush: cpp; title: ; notranslate">std::vector&lt;base_type*&gt;</pre>
<p>To get that done, we&#8217;ll use semantic actions inside the kwd directive:</p>
<pre class="brush: cpp; title: ; notranslate">

kwd_rule = kwd(&quot;derived1&quot;)[
              ('=' &gt; parse_string &gt; int_ )
              [phx::push_back(_val,phx::new_&lt;derived1&gt;(_1,_2))]
           ]
         / kwd(&quot;derived2&quot;)[
              ('=' &gt; parse_string &gt; int_ )
              [phx::push_back(_val,phx::new_&lt;derived2&gt;(_1,_2))]
           ]
         / kwd(&quot;derived3&quot;)[
              ('=' &gt; parse_string &gt; int_ &gt; double_)
              [phx::push_back(_val,phx::new_&lt;derived3&gt;(_1,_2,_3))]
           ]
           ;

</pre>
<p>This rule will construct new derived classes and append them to our result vector during parsing. The input parsed by this construct is of the form:</p>
<pre class="brush: plain; title: ; notranslate"> derived2 = &quot;object1&quot; 10 derived3= &quot;object2&quot; 40 20.0 </pre>
<h4>Keywords vs Nabialek trick</h4>
<p>Here&#8217;s a small table to compare the features of the keyword parsing constructs and the Nabialek trick to help you decide which solution better suits your needs.</p>

<table id="wp-table-reloaded-id-1-no-1" class="wp-table-reloaded wp-table-reloaded-id-1">
<thead>
	<tr class="row-1 odd">
		<th class="column-1"></th><th class="column-2">Nabialek trick</th><th class="column-3">Keywords parser</th>
	</tr>
</thead>
<tbody>
	<tr class="row-2 even">
		<td class="column-1">Attribute propagation</td><td class="column-2">no</td><td class="column-3">yes</td>
	</tr>
	<tr class="row-3 odd">
		<td class="column-1">Runtime modification of the keyword set</td><td class="column-2">yes</td><td class="column-3">no</td>
	</tr>
	<tr class="row-4 even">
		<td class="column-1">Occurrence constraints</td><td class="column-2">not easily implented</td><td class="column-3">yes</td>
	</tr>
	<tr class="row-5 odd">
		<td class="column-1">Number of keyword limit</td><td class="column-2">available runtime memory</td><td class="column-3">BOOST_VARIANT_LIMIT_TYPES</td>
	</tr>
</tbody>
</table>

<p>The keywords parsing construct can save a lot of typing over the <a title="Nabialek trick" href="http://boost-spirit.com/home/articles/qi-example/nabialek-trick/" target="_blank">Nabialek trick</a> and has in many cases even better performance. It also makes retrieving the parsed data into the program usable structures much easier as it supports attribute propagation. The main limitation of the keyword parser is the number of keywords a keyword block may contain ( limited by the maximum size of the variant type BOOST_VARIANT_LIMIT_TYPES).</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Boost-Spirit?a=DG93HWmk4I0:aQG_jAvTyMQ:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Boost-Spirit?d=yIl2AUoC8zA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Boost-Spirit/~4/DG93HWmk4I0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://boost-spirit.com/home/2011/04/16/the-keyword-parser/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://boost-spirit.com/home/2011/04/16/the-keyword-parser/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=the-keyword-parser</feedburner:origLink></item>
	</channel>
</rss>
