On 20/09/10 19:59, Roland Bock wrote:
Hi,
I am trying to create a DSEL with Boost.Proto, which (among other things) should allow expressions like
i == j + 3 && t != "foo"
and want to prevent disallowed operators to be generated by Proto.
Please consider the code below.
// ----------------------------------------------------------------------- #include<boost/proto/proto.hpp>
using namespace boost;
typedef proto::terminal<int>::type terminal;
struct addition: proto::or_ < terminal, proto::plus<addition, addition>
{};
struct equation: proto::equal_to<addition, addition> {};
struct condition: proto::or_ < equation, proto::logical_and<equation, equation>
{};
In my_domain, I can replace condition by addition, which allows i + i, but then the == operator is still missing (and the &&, too, probably).
i+i doesn't match your grammar at all. an equation is addition == addition which is not matchable by i+i if equation was: struct equation: proto::or_< addition, proto::equal_to<addition, addition> > {}; then it'll work.