title: Is it possible to re-use boost::spirit::qi grammar in another grammar definition?
body: <p><strong>Is it possible to reuse <code>boost::spirit:qi</code> grammar in another grammar (as a rule for example)?</strong></p>
  
  <p>For example if I define a grammar to parse line of text into a structure holding street address.</p>
  
  <pre><code>   template&lt; typename iter &gt;
          struct address_grammar : qi::grammar&lt; iter, address() &gt;
     {
       ...
  
         qi::rule&lt; iter, std::string() &gt; street_name;
         qi::rule&lt; iter, std::string() &gt; street_number;
         qi::rule&lt; iter, address() &gt; address_;
     }
  </code></pre>
  
  <p>I might want to reuse that grammar in two other grammars, for example one might be for parsing of a vector of addresses stored in a file. Another re-use might be in more complex structure where one of the fields is this street address structure.</p>
  
  <pre><code>  template&lt; typename iter &gt;
        struct company_grammar : qi::grammar&lt; iter, company() &gt;
    {
       ...
       qi::rule&lt; iter, std::string() &gt; comp_name;
       // can I reuse the address grammar somehow here ???
       qi::rule&lt; iter, company() &gt; company;
    }
  </code></pre>
  
  <p>Instead of defining the whole grammar in one place I'm thinking to split it into smaller reusable blocks, it is fine if they are inside one header file. My data structures are slightly more complex (couple of fields inside struct with a list of other structures and so on) so I don't want to put it into one grammar.</p>
  
  <p>Is it possible to reuse <code>boost::spirit::qi</code> grammar in this way?</p>
  
  <p><strong>EDIT:</strong> Thinking about it, do I just define <code>qi::rule</code>s in a namespace and then put together a grammar from the rules that I need?</p>