[Proto] Stuck turning a complex gramamr action to a primitive trasnform

I tried to turn a complex grammar transform : struct grammar : or_< ... ,bp::when< bp::nary_expr< bp::_, bp::vararg< grammar > > , bp::_default< grammar > ( _bp::functional::unpack_expr<bp::tag::function>( push_front( bp::_ , bp::_make_terminal ( some_type< bp::tag_of<bp::_> >() ) ) ) ) > into a single primitive transform but I end up stuck cause it seems some of those transform (make_terminal) don't follow the classic proto::result_of/proto namespace acces to compute it's return type and calling it. How should I handle these ? My intuition was that the transform oeprator() will call the equivalent function onto its expr parameters while its result struct compute the result_of by chaining the transform result_of results. Ultimately, I want this to be a tempalte trasnform that take some_type as a parameter : bp::when< bp::nary_expr< bp::_, bp::vararg< grammar > > , traversal<some_type>(bp) > Thanks in advance -- ___________________________________________ Joel Falcou - Assistant Professor PARALL Team - LRI - Universite Paris Sud XI Tel : (+33)1 69 15 66 35

joel wrote:
I tried to turn a complex grammar transform : struct grammar : or_< ...
,bp::when< bp::nary_expr< bp::_, bp::vararg< grammar > > , bp::_default< grammar > (
_bp::functional::unpack_expr<bp::tag::function>( push_front( bp::_ , bp::_make_terminal ( some_type< bp::tag_of<bp::_> >() ) ) ) ) >
into a single primitive transform but I end up stuck cause it seems some of those transform (make_terminal) don't follow the classic proto::result_of/proto namespace acces to compute it's return type and calling it.
I don't know what you mean. Are you referring to the fact that _make_terminal is not a primitive transform? It is a callable function object. Unfortunately, the _make_terminal name follows Proto's naming conventions for primitive transforms, even though it isn't. Is that what has thrown you off? -- Eric Niebler BoostPro Computing http://www.boostpro.com

Eric Niebler wrote:
I don't know what you mean. Are you referring to the fact that _make_terminal is not a primitive transform? It is a callable function object. Unfortunately, the _make_terminal name follows Proto's naming conventions for primitive transforms, even though it isn't. Is that what has thrown you off? Ah, seems so yes. So I have to take it's boost::result_of instead of seekign a non-existant result_of::make_terminal ?
If yes is my idea of composing ok ? -- ___________________________________________ Joel Falcou - Assistant Professor PARALL Team - LRI - Universite Paris Sud XI Tel : (+33)1 69 15 66 35

joel wrote:
Eric Niebler wrote:
I don't know what you mean. Are you referring to the fact that _make_terminal is not a primitive transform? It is a callable function object. Unfortunately, the _make_terminal name follows Proto's naming conventions for primitive transforms, even though it isn't. Is that what has thrown you off?
Ah, seems so yes. So I have to take it's boost::result_of instead of seekign a non-existant result_of::make_terminal ?
proto::_make_terminal is just a typedef for proto::functional::make_terminal, which is itself a typedef for proto::functional::make_expr<proto::tag::terminal>. If you're looking for the corresponding result_of:: metafunction, you should use proto::result_of::make_expr<proto::tag::terminal, ...args...>
If yes is my idea of composing ok ?
Sure. -- Eric Niebler BoostPro Computing http://www.boostpro.com
participants (2)
-
Eric Niebler
-
joel