Hi,

On Thu, 15 May 2014, Richard Biener wrote:

> To me predicate (and capture without expression or predicate)
> differs from expression in that predicate is clearly a leaf of the
> expression tree while we have to recurse into expression operands.
> 
> Now, if we want to support applying predicates to the midst of an
> expression, like
> 
> (plus predicate(minus @0 @1)
>         @2)
> (...)
> 
> then this would no longer be true.  At the moment you'd write
> 
> (plus (minus@3 @0 @1)
>         @2)
>   if (predicate (@3))
> (...)
> 
> which makes it clearer IMHO (with the decision tree building
> you'd apply the predicates after matching the expression tree
> anyway I suppose, so code generation would be equivalent).

Syntaxwise I had this idea for adding generic predicates to expressions:

(plus (minus @0 @1):predicate
      @2)
(...)

If prefix or suffix doesn't matter much, but using a different syntax
to separate expression from predicate seems to make things clearer.  
Optionally adding things like and/or for predicates might also make sense:

(plus (minus @0 @1):positive_p(@0) || positive_p(@1)
      @2)
(...)


Ciao,
Michael.

Reply via email to