You are here: Re: how to parse an expression? « PHP Language « IT news, forums, messages
Re: how to parse an expression?

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация