
Dave Jenkins schrieb:
"Eric Niebler" <eric@boost-consulting.com> wrote in message news:4978F428.8080107@boost-consulting.com...
A general equation solver will be challenging to write, but should be possible. You'll need to familiarize yourself with Proto grammars and transforms. Here is a toy example to get you started. Hope it helps.
Thank you very much for this starting project.
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.) Btw Eric, do you plan to give a session in proto in boostcon 09? With regards, Kim Tang