Boost logo

Boost Users :

Subject: [Boost-users] [Proto] implementing an computer algebra system with proto
From: Kim Kuen Tang (kuentang_at_[hidden])
Date: 2009-01-22 15:39:11


Hi all,

considering the following expression created with proto:

    "3 *var_+5=2;

.. The tree would be :
           =
         / \
       + 2
      / \
    * 5
   / \
  3 var_

 Here the term "var_" is somewhat a placeholder.

I wonder wheter it is possible now to change the structure of the tree.
That is i want to define a grammar that is able to produce another
expression like this.

    "var_=(2-5)/3;"

In tree:

           =
         / \
      var_ div
              / \
            - 3
           / \
         2 5

With this expression i can now define a context that return the final
result of the right hand side.
But is this possible in proto with the existing functions? This
situation is somewhat different from the examples in the documentation.
Here i dont want to replace the child node. The whole structure of the
input tree should be transformed in another one.

Cheers
Kim Tang


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