Boost logo

Boost Users :

Subject: Re: [Boost-users] [proto] Unable to display_expr a spirit expression
From: Marcin Zalewski (marcin.zalewski_at_[hidden])
Date: 2010-11-21 15:27:32


On Sun, Nov 21, 2010 at 13:02, Hartmut Kaiser <hartmut.kaiser_at_[hidden]> wrote:
>> I have a following program:
>>
>> #include <boost/spirit/include/qi.hpp>
>> #include <boost/spirit/include/phoenix_core.hpp>
>> #include <boost/proto/core.hpp>
>>
>> int main () {
>>   // boost::proto::display_expr(boost::phoenix::arg_names::arg1);
>>
>> boost::proto::display_expr(boost::spirit::int_[boost::phoenix::arg_names::
>> arg1]);
>> }
>>
>> That works as expected:
>>
>> subscript(
>>     terminal(N5boost6spirit3tag4int_E)
>>   , terminal(N5boost7phoenix5actorINS0_8argumentILi0EEEEE)
>> )
>>
>> When I include <boost/spirit/home/phoenix/operator.hpp> (as the last
>> include), however, the output of the program changes to:
>>
>> subscript(
>>     terminal(N5boost6spirit3tag4int_E)
>>   , terminal()
>>
>> I am not sure if this is expected, unsupported, or a bug. Anyone?
>
> That's expected as Proto does not know anything about Phoenix (V2). This
> will be different with the new Phoenix V3 (in development), which is built
> on top of Proto as well.

Sure, I understand that phoenix2 is not written with proto. What I
find hard to understand and to explain is that just including the
phoenix operators (the only change between the programs) changes the
output of display_expr. Also note that in the second program the
output appears cut off. Is this what is supposed to happen?

>> Just to put this in context, I am trying to figure out how does spirit
>> intercept phoenix expressions (e.g., in semantic actions) to wrap them in
>> proto terminals. The infrastructure of spirit is rather complex, so if
>> anyone can point me in the right direction, I would really appreciate it.
>
> Spirit has special code to deal with Phoenix V2 function objects. For
> instance, Phoenix semantic actions are handled here:
> spirit/home/support/action_dispatch.hpp, line 41.

Thanks, I will look into this.

> Regards Hartmut
> ---------------
> http://boost-spirit.com
>
>
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net