|  | Posted by shimmyshack on 09/04/07 20:34 
On Sep 4, 6:56 pm, "_mario.lat" <n...@libero.it> wrote:> Hallo,
 > I have to parse an expression for example like that:
 > 2*MY_COST1*log(4*MYCOST2)+4
 >
 > How can I do?
 > any suggestions?
 >
 > Thank you in advance,
 > Mario.
 
 not easily, you must write down the rules of maths for all the
 expressions you will allow.
 then you must decide whether to split or capture parts of the
 expressions, constructing a series of regular expressions (rather than
 just one for clarity)
 which will capture the unit parts of the expression along with their
 priority.
 
 i have never attempted a maths parser, but there must be tonnes of
 open source code out there, recommend you go looking for open source C
 or C++ code for a project that has the functionality and look at the
 code
  Navigation: [Reply to this message] |