Connecting Tech Pros Worldwide Forums | Help | Site Map

Equation parser - where did I see it?

trashman.horlicks@btinternet.com
Guest
 
Posts: n/a
#1: Feb 15 '07
Hi,
A few months ago, I saw an equation parser, written in c#, and using
regular expressions (I think!), but now I cannot recall where I saw
it- if anyone saw anything like this, could they please post the url?
Quote:
>From memory,
the parser not only dealt with operator precedence, but also the use
of brackets, so that any complicated expession could be re-written as
an equation that could be read from left-to-right, as a simple
sequence of sub-equations using basic operators, +,-,/,*

The reason why I ask is that I am anticipating user input into a form
as a string, and I need to convert it into
an equation. The user inputted expression could be something like (a+
(b-d)*(e-c))/f so I need to find a way to parse it.

TIA

Paul


ClayB
Guest
 
Posts: n/a
#2: Feb 15 '07

re: Equation parser - where did I see it?


I doubt if this is what you saw earlier, but here is a link to a
TRINUG usergroup meeting presentation that describes making a
WindowsForm DataGridView into Excel. It has a very simple/minimal C#
calculation engine defined that handles precedence and parentheses.
Maybe it will be of help in your task.

http://www.trinug.org/Portals/0/DataGridViewCustomization%20-%20Oct%20'06.zip

=======================
Clay Burch
Syncfusion, Inc.

Fabrizio
Guest
 
Posts: n/a
#3: Feb 15 '07

re: Equation parser - where did I see it?


Maybe this: http://www.osix.net/modules/article/?id=761
Or this: http://www.osix.net/modules/article/?id=776

HTH
Fabrizio

<trashman.horlicks@btinternet.comwrote in message
news:1171533823.531106.146570@k78g2000cwa.googlegr oups.com...
Quote:
Hi,
A few months ago, I saw an equation parser, written in c#, and using
regular expressions (I think!), but now I cannot recall where I saw
it- if anyone saw anything like this, could they please post the url?
Quote:
>>From memory,
the parser not only dealt with operator precedence, but also the use
of brackets, so that any complicated expession could be re-written as
an equation that could be read from left-to-right, as a simple
sequence of sub-equations using basic operators, +,-,/,*
>
The reason why I ask is that I am anticipating user input into a form
as a string, and I need to convert it into
an equation. The user inputted expression could be something like (a+
(b-d)*(e-c))/f so I need to find a way to parse it.
>
TIA
>
Paul
>

ClayB
Guest
 
Posts: n/a
#4: Feb 15 '07

re: Equation parser - where did I see it?


One other comment is that there are commercial products that would
allow you to write code that would input a string like (a+(b-c)*(e-c)/
f, identify the unknowns a,b,c,d,e,f, and then allow your user to
input the values for these unknowns and finally compute the entered
expression.

===============================
Clay Burch
Syncfusion, Inc.

Guest
 
Posts: n/a
#5: Feb 15 '07

re: Equation parser - where did I see it?


Are you looking for this ?

http://www.codeproject.com/csharp/RP...sionParser.asp

Regards,

Bart


trashman.horlicks@btinternet.com
Guest
 
Posts: n/a
#6: Feb 15 '07

re: Equation parser - where did I see it?


On 15 Feb, 11:08, <wwrote:
Quote:
Are you looking for this ?
>
http://www.codeproject.com/csharp/RP...sionParser.asp
>
Regards,
>
Bart
They weren't what I saw, but they're still very useful!

Thanks a million for the quick replies, they may just save my life :)

Best wishes

Paul

William Stacey [C# MVP]
Guest
 
Posts: n/a
#7: Feb 16 '07

re: Equation parser - where did I see it?


Taking a dependancy on powershell may not work for you, but would allow you
to invoke any expression you can do on the command line and also can use any
..net lib (i.e. system.math) or external lib. And you can script your host
with it too if needed.

--
William Stacey [C# MVP]
PCR concurrency library: www.codeplex.com/pcr
PSH Scripts Project www.codeplex.com/psobject


<trashman.horlicks@btinternet.comwrote in message
news:1171533823.531106.146570@k78g2000cwa.googlegr oups.com...
| Hi,
| A few months ago, I saw an equation parser, written in c#, and using
| regular expressions (I think!), but now I cannot recall where I saw
| it- if anyone saw anything like this, could they please post the url?
| >From memory,
| the parser not only dealt with operator precedence, but also the use
| of brackets, so that any complicated expession could be re-written as
| an equation that could be read from left-to-right, as a simple
| sequence of sub-equations using basic operators, +,-,/,*
|
| The reason why I ask is that I am anticipating user input into a form
| as a string, and I need to convert it into
| an equation. The user inputted expression could be something like (a+
| (b-d)*(e-c))/f so I need to find a way to parse it.
|
| TIA
|
| Paul
|


Closed Thread