Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi...
I want to create a formula parser which can parse formulas similar to the ones created in Excel...
for example formula like...
If(Condition(s),ValueIfTrue,ValuIfFalse)

can anyone please tell me if I can get such a parser....
Posted

You can avoid creating your own parser. You can use the one already available as a C# or VB.NET compiler, which are the part of Framework redistributable and are always available via CodeDOM.

Here is how to do it:
code generating using CodeDom[^];
See also:
Create WPF Application that uses Reloadable Plugins...[^].

—SA
 
Share this answer
 
v2
Comments
Nuri Ismail 7-Apr-11 6:02am    
Good advice. My 5.
And your linked answers, I wish I could give more than 5 for them. :)
Sergey Alexandrovich Kryukov 7-Apr-11 6:13am    
Do you means you voted 5 three times? This is more then enough :-)
Thank you, Nuri.
--SA
Nuri Ismail 7-Apr-11 6:16am    
Yes I 5-ed the linked answers, too. But IMHO, your efforts deserve more... :)
Sergey Alexandrovich Kryukov 7-Apr-11 12:35pm    
Thank you. You not gonna believe that, but I just answered another Question about using CodeDOM and dynamically compiled Assembly with even more tricky (and crazy, of course) requirements.

This is most funny:
http://www.codeproject.com/Answers/178490/how-to-get-the-text-of-a-label-using-codedom.aspx

I suspect the patient has no idea where she or he is trying to get into. Hope my answer can be sobering, no more. I can't believe that new OP would be able to write anything working in any observable period of time. And the purpose of it hardly can justify such work.

Take a look, this is really funny.

--SA
Nuri Ismail 8-Apr-11 5:49am    
This sounds very interesting. I'll check out your answer right now. :)
This article could be interesting for you: Evaluation Engine[^]
 
Share this answer
 
Comments
walterhevedeich 7-Apr-11 21:49pm    
Good point. voted 5.
Wendelius 8-Apr-11 1:24am    
Thank you :)
Have also a look at Simple Math Parser[^].
:-)
 
Share this answer
 
Comments
walterhevedeich 7-Apr-11 21:49pm    
Good point. voted 5.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900