Re: Expression parser

From: Cor Ligthert (notmyfirstname_at_planet.nl)
Date: 01/05/05


Date: Wed, 5 Jan 2005 09:59:27 +0100

Robby,

Interesting answer, I keep it in mind.

Thanks,

Cor

"Robby" <edmund@not.my.email.com>

>
> You can do this with Regular expressions. Francesco Balena's book
> "Programming Microsoft Visual Basic.Net" has a complete solution with full
> code on the companion CD. There is a newer version of the book for .Net
> 2003 but it still has all the code you need. It is surprisingly compact
> when done with Regex and uses only one class to do all the work.
>
> Robby
>
>
> "Joe" <J_no_spam@_no_spam_Fishinbrain.com> wrote in message
> news:eKDshQu8EHA.2060@TK2MSFTNGP10.phx.gbl...
>>I have a screen which allows the user to create mathematical expressions
>> using a combination of literal values, other expressions and field
>> values.
>>
>>
>> For example if I have the following:
>>
>> // fields
>> string val1 = "2";
>> string val2 = "1";
>> string val3 = "4.5";
>>
>> //expressions
>> string expr1 = "8 * val1 / val2 + val3";
>> string expr2 = "val2 * expr1 + 3";
>>
>> I need to parse this out to perform the actually calculation.
>> string expr2 would expand to 1 * 8 * 2 / 1 + 3 + 3;
>>
>> Any suggestions on how to do this? I already created a number of classes
>> to
>> handle this but I'm still missing some possible combinations.
>>
>>
>
>