473,499 Members | 1,619 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Equation parser - where did I see it?

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

Feb 15 '07 #1
6 7981
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.

Feb 15 '07 #2
Maybe this: http://www.osix.net/modules/article/?id=761
Or this: http://www.osix.net/modules/article/?id=776

HTH
Fabrizio

<tr***************@btinternet.comwrote in message
news:11**********************@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

Feb 15 '07 #3
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.

Feb 15 '07 #4
Are you looking for this ?

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

Regards,

Bart
Feb 15 '07 #5
On 15 Feb, 11:08, <wwrote:
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

Feb 15 '07 #6
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
<tr***************@btinternet.comwrote in message
news:11**********************@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
|
Feb 16 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
6033
by: Sven Dzepina | last post by:
Hello people =) Has somebody a nice script, which can solve equations ? It would be super, if someone has an idea where I can get such a script / code in php. Thanks. Gretting!
1
1616
by: Russell Blau | last post by:
This is not really a Python question, but it does relate to a Python program I'm working on, so this seems like as good a place as any to ask for suggestions ... I'm working on a GUI application...
20
8665
by: Brian Kazian | last post by:
Here's my problem, and hopefully someone can help me figure out if there is a good way to do this. I am writing a program that allows the user to enter an equation in a text field using...
9
8900
by: Stud Muffin | last post by:
Hey Basically, I'm trying to take objects created in microsoft word using equation editor (for creating clean looking math/physics equations) and putting them into some sort of webpage format....
5
3244
by: gamehack | last post by:
Hi all, I was thinking about parsing equations but I can't think of any generic approach. Basically I have a struct called math_term which is something like: struct math_term { char sign; int...
5
3061
w33nie
by: w33nie | last post by:
My table is pretty well complete, but I would prefer it if the value for Points could be turned into a mathematical equation, and this equation would use the data from the other fields in the table...
6
14827
by: Trev17 | last post by:
Hello, I am new to C++ and i have tried for several hours to make a program my teacher has given me as a lab. Here is the Lab question: the roots of the quadratic equation ax^2 + bx + c = 0, a...
10
2342
by: Constantine AI | last post by:
Hi i am having a little problem with an equation function that was created from all your help previously. The function works fine itself but with a small glitch within it. Here is the function...
2
3749
by: phoenix1990 | last post by:
so i have an entry frame where i want to input an equation, and i need to turn the string into an actual equation in terms of x. so that i can plot it on a canvas. i already know how to make the...
0
7134
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7014
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
6905
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7395
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5485
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3108
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3103
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1429
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
667
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.