• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<title>Quick Start</title>
5<link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css">
6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7<link rel="home" href="../../../index.html" title="Spirit 2.5.8">
8<link rel="up" href="../tutorials.html" title="Tutorials">
9<link rel="prev" href="../tutorials.html" title="Tutorials">
10<link rel="next" href="warming_up.html" title="Warming up">
11</head>
12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13<table cellpadding="2" width="100%"><tr>
14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
15<td align="center"><a href="../../../../../../../index.html">Home</a></td>
16<td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
17<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
18<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
19<td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
20</tr></table>
21<hr>
22<div class="spirit-nav">
23<a accesskey="p" href="../tutorials.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../tutorials.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="warming_up.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
24</div>
25<div class="section">
26<div class="titlepage"><div><div><h4 class="title">
27<a name="spirit.karma.tutorials.quick_start"></a><a class="link" href="quick_start.html" title="Quick Start">Quick Start</a>
28</h4></div></div></div>
29<h6>
30<a name="spirit.karma.tutorials.quick_start.h0"></a>
31          <span class="phrase"><a name="spirit.karma.tutorials.quick_start.spirit_karma___what_s_that_"></a></span><a class="link" href="quick_start.html#spirit.karma.tutorials.quick_start.spirit_karma___what_s_that_">Spirit.Karma
32          - what's that?</a>
33        </h6>
34<p>
35          Throughout the description of <span class="emphasis"><em>Spirit.Karma</em></span> we will
36          try to align ourselves very much with the documentation for <span class="emphasis"><em>Spirit.Qi</em></span>.
37          The reasons are many fold:
38        </p>
39<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
40<li class="listitem">
41              <span class="emphasis"><em>Spirit.Karma</em></span> is the counterpart to <span class="emphasis"><em>Spirit.Qi</em></span>.
42              Some people say it's the Yin to <span class="emphasis"><em>Spirit.Qi</em></span>'s Yang.
43              <span class="emphasis"><em>Spirit.Karma</em></span> is generating byte sequences from
44              internal data structures as <span class="emphasis"><em>Spirit.Qi</em></span> is parsing
45              byte sequences into those (very same) internal data structures.
46            </li>
47<li class="listitem">
48              Both libraries have an almost identical structure, very similar semantics,
49              and are both built using identical tools. Both libraries implement
50              a language casting the specifics of their domain (parsing and generating)
51              into a simple interface.
52            </li>
53</ul></div>
54<p>
55          Why should you use a generator library for such a simple thing as output
56          generation? Programmers have been using <code class="computeroutput"><span class="identifier">printf</span></code>,
57          <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">stream</span></code> formatting, or <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">format</span></code>
58          for quite some time. The answer is - yes, for simple output formatting
59          tasks those familiar tools might be a quick solution. But experience shows:
60          as soon as the formatting requirements are becoming more complex output
61          generation is getting more and more challenging in terms of readability,
62          maintainability, and flexibility of the code. Last, but not least, it turns
63          out that code using <span class="emphasis"><em>Spirit.Karma</em></span> runs much faster
64          than equivalent code using either of the 'straight' methods mentioned above
65          (see here for some numbers: <a class="link" href="../performance_measurements/numeric_performance.html" title="Performance of Numeric Generators">Performance
66          of Numeric Generators</a>)
67        </p>
68<p>
69          You might argue that more complex tasks require more complex tools. But
70          this turns out not to be the case! The whole Spirit library is designed
71          to be simple to use, while being scalable from trivial to very complicated
72          applications.
73        </p>
74<p>
75          In terms of development simplicity and ease in deployment, the same is
76          true for <span class="emphasis"><em>Spirit.Karma</em></span> as has been described elsewhere
77          in this documentation for <span class="emphasis"><em>Spirit.Qi</em></span>: the entire library
78          consists of only header files, with no libraries to link against or build.
79          Just put the spirit distribution in your include path, compile and run.
80          Code size? Very tight, essentially comparable to hand written code.
81        </p>
82<p>
83          The <span class="emphasis"><em>Spirit.Karma</em></span> tutorials are built in a walk through
84          style, starting with elementary things growing step by step in complexity.
85          And again: keep in mind output generation is the exact opposite of parsing.
86          Everything you already learnt about parsing using <span class="emphasis"><em>Spirit.Qi</em></span>
87          is applicable to generating formatted output using <span class="emphasis"><em>Spirit.Karma</em></span>.
88          All you have to do is to look at <span class="emphasis"><em>Spirit.Karma</em></span> as being
89          a mirror image of <span class="emphasis"><em>Spirit.Qi</em></span>.
90        </p>
91</div>
92<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
93<td align="left"></td>
94<td align="right"><div class="copyright-footer">Copyright © 2001-2011 Joel de Guzman, Hartmut Kaiser<p>
95        Distributed under the Boost Software License, Version 1.0. (See accompanying
96        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
97      </p>
98</div></td>
99</tr></table>
100<hr>
101<div class="spirit-nav">
102<a accesskey="p" href="../tutorials.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../tutorials.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="warming_up.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
103</div>
104</body>
105</html>
106