Boost logo

Boost Users :

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


Dave Jenkins wrote:
> "Kim Kuen Tang" wrote:
>> The next step will be to extend the grammar with the feature of
>> transforming such expression "1+2+var_+3=4" into
>> this "var_=4-1-2-3".
>
> I think the attached program solves that problem.
>
> The problem I've been working on is to use the distributive law to
> simplify expressions at compile time.
> For example, I'd like to transform "var_ * 2 + var_ * 3 = 4" to "var_ *
> (2 + 3) = 4".
> Then, you could transform it to "var_ = 4 / (2 + 3)", all at compile time.
> Wouldn't that be cool?

Yes!

> I think it's possible using Proto, but I haven't
> worked out the details yet.
> Any suggestions are welcome.

<snip>

Pretty cool, Dave. I wish I had more time to lend a hand, but you and
Kim seem to be doing just fine on your own. It makes me really happy to
see folks finding interesting uses for Proto transforms.

-- 
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