I am playing around with Spirit and I seem to run into an architecture problem with semantic actions. Here's a small example. class MyGrammar : public grammar<MyGrammar> { public: template <typename ScannerT> struct definition { definition(MyGrammar const& self) { TestRule = str_p("test")[&my_action]; } rule<ScannerT> const& start() const { return TestRulet; }; private: rule<ScannerT> TestRule; }; }; My major problem is related to the fact that I cannot pass any custom data to my_action function. Since my_action is a global function, it has no knowledge of MyGrammar and must rely on global variables. Ideally, I would pass self to my_action to be able to hold state. What is a general way to get around this problem? The documention mentions a way to specify member functions as semantic action actors using boost's bind facilities but I was unable to get it to work. Thanks in advance. P.S. Sorry for a fairly newbie question, I was unable to find the answer online or in the docs. P.P.S. I might have accidently double posted this. Sorry about that.