Boost logo

Boost Users :

Subject: Re: [Boost-users] [Proto] automaitcally convert class to proto literal
From: Daniel Oberhoff (daniel.oberhoff_at_[hidden])
Date: 2009-01-05 02:55:38


Joel Falcou wrote:

> Daniel Oberhoff a écrit :
> > Hi,
> >
> > I am stilly trying o get my array computation DSEL up and running.
> > The basic grammar is in place, what I am fighting with is protfying
my
> > literals. I.e. I have an array class, and I want the following
> > expression:
> >
> > A(_i,_j)
> >
> > to become a function(literal<Array>(A), index_placeholder<0>,
> > index_placeholder<1>)
> Why A should be a litteral and not terminal ?

I might have gotten the terms wrong. But the way I got it working now is
with using proto::lit which turns things into literals. I tried
subclassing terminal with my array class, but that way the tree did not
keep a reference to the array, and thus could not be evaluated as such.
Subclassing literal did not work because I did not find a way to
actually have the literal take a reference to the array itself. I could
of course use a placeholder syntax, and pass in the actual arrays at
evaluation time but I want expressions to work "in-place", i.e. I want
to be able to write

A(_i,_j) = B(_i) * C(_j);

and that to just be evaluated as it stands there. Enabling placeholders
could be a useful feature, but that would be relatively easy to add.

-- 
---
Daniel Oberhoff
Fraunhofer FIT
Schloss Birlinghoven
53754 Sankt Augustin, Germany
Tel.: +49-(0)-2241-14-3486
Fax.:+49 (0) 2241/14-2080

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