Boost logo

Proto :

Subject: Re: [proto] : How to use complex grammars in a domain/extension
From: Eric Niebler (eric_at_[hidden])
Date: 2010-09-21 15:43:18


On 9/21/2010 10:19 AM, Roland Bock wrote:
> On 09/21/2010 04:01 PM, Eric Niebler wrote:
>> The answer is simple and logically consistent: make sure *every* valid
>> expression in your domain (including lone terminals) is accounted for by
>> your grammar.
>
> OK, it is sinking in, slowly :-)
>
> Maybe I missed the equivalent part in the documentation, but the list
> given by Thomas would make a very good section.
>
>> 1) the operands must be in a compatible domain
>> 2) the left hand operand and the right hand operand must match the
>> grammar
>> specified in the domain
>> 3) the resulting expression must match the grammar specified in the
>> domain.

Yes, agreed. Something like this should be in the docs. Would you mind
filing a trac ticket (http://svn.boost.org) so this doesn't get lost?

> Also, maybe as an illustrating example:
>
> This grammar
>
> proto::plus<proto::terminal<int>, proto::terminal<int> >
>
> used in a domain would not allow
>
> i + i;
>
> with i being an int-terminal.

Yes, that also should be noted.

> Thanks for all the answers!

No problem.

-- 
Eric Niebler
BoostPro Computing
http://www.boostpro.com

Proto list run by eric at boostpro.com