title: Boost spirit semantic action
body: <p>I'am trying to attach a simple semantic action to my grammar using boost spirit.</p>
  
  <p>This is my code:</p>
  
  <pre><code>#define  BOOST_SPIRIT_NO_REGEX_LIB
  
  #include "regex.h"
  #include "spirit.hpp"
  #include "spirit/actor/assign_actor.hpp"
  #include &lt;boost/spirit/include/karma.hpp&gt;
  #include &lt;boost/spirit/include/support_utree.hpp&gt;
  #include &lt;boost/spirit/include/phoenix_core.hpp&gt;
  #include &lt;boost/spirit/include/phoenix_operator.hpp&gt;
  #include &lt;boost/fusion/include/std_pair.hpp&gt;
  #include &lt;boost/config/warning_disable.hpp&gt;
  #include &lt;boost/lambda/lambda.hpp&gt;
  #include &lt;boost/bind.hpp&gt;
  #include &lt;iostream&gt;
  #include &lt;string&gt;
  
  
  using namespace std;
  using namespace boost::spirit;
  using boost::phoenix::bind;
  
  
  
      // A plain function
      void dummy( )
      {
      int i=20;
          std::cout &lt;&lt; i &lt;&lt; std::endl;
      }
  
  
  
  
  
  struct my_enum : public grammar&lt;my_enum&gt;
      {
  
      template &lt;typename ScannerT&gt;
        struct definition
          {
          definition(my_enum const&amp; self)
            { 
  
            enum_specifier = enum_p &gt;&gt; '{' &gt;&gt; enum_list &gt;&gt; '}' [boost::phoenix::bind(dummy)];
            enum_p = str_p("enum");
            enum_list = +id_p &gt;&gt; *(',' &gt;&gt; +id_p);
            id_p = range_p('a','z');
            }
  
            rule&lt;ScannerT&gt; enum_specifier, enum_p, enum_list, id_p;
            rule&lt;ScannerT&gt; const&amp; start() const { return enum_specifier; }
          };
      };
  
  string input = "enum { ah, bk, ss  }";
  
  int main ()
    {     
    my_enum e;
    int status = parse(input.c_str(), e, space_p).hit;
    cout &lt;&lt; status &lt;&lt; endl;
    return 0;
  }
  </code></pre>
  
  <p>I get an infinite error that I am not able to understand.
  COuld someone can give me some advice/Example about how to map semantic functions? </p>