Boost logo

Boost Users :

Subject: Re: [Boost-users] [Proto] implementing an computer algebra systemwith proto
From: Eric Niebler (eric_at_[hidden])
Date: 2009-01-26 13:13:30


Kim Kuen Tang wrote:
> Dave Jenkins schrieb:
>> Suppose you want to move a series of additions to the right hand side.
>> For example, transforming "var_ + 1 + 3 = 2" into "var_ = 2 - 3 - 1".
>>
>> Is there a general way to iterate the Solve() transform until all the
>> plusses are consumed?
>> Or do you need multiple calls to Solve(), e.g. "proto::display_expr(
>> Solve()Solve()( var_ + 1 + 3 = 2 ) );"
>
> The grammar Solve should call himself recursively until it matches a
> desired expression. The stopping rule is the grammar
>
> "proto::when<proto::assign<proto::terminal<placeholder>, _> >" .
>
> So once the grammar
> "proto::when<
> proto::assign< proto::plus<proto::terminal<placeholder>, _>, _ >
> ,proto::_make_assign( proto::_left(proto::_left) ,
> proto::_make_minus( proto::_right, proto::_right(proto::_left) ) )
> >"
> is extended with the feature of calling Solve recursively, then multiple
> calls to Solve is not needed.
> (I am trying to implement this feature.)

That's exactly the right approach. With Proto grammars and transforms,
you replace iteration with recursion.

> Btw Eric, do you plan to give a session in proto in boostcon 09?

No, but I gave a session about Proto at the last 2 boostcons, and the
slides are online here:

http://www.boostcon.com/site-media/var/sphene/sphwiki/attachment/2009/01/26/proto_authors_corner_.pdf

HTH,

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

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