Click here to Skip to main content
15,913,854 members
Home / Discussions / C#
   

C#

 
GeneralRe: Evaluating expressions Pin
Jeff Varszegi25-Apr-04 20:37
professionalJeff Varszegi25-Apr-04 20:37 
I think your options are several. You can write your own parser and evaluator from scratch (I don't know your background, but you can look up recursive-descent parsing, the "Little Language" pattern, etc. for easy starters); use a code-emitting approach like the one in this Code Project article; or use a tool like YACC or JavaCC. I haven't taken the time to do a search, but I'm sure there's something similar to the last one out there for .NET, and if not, it would be a fun port to do.

I've also used database engines for this kind of stuff in the past, but I think if you can do it directly, it would be a much better approach. I was kind of iffy on the idea before I wrote my first small parser a long time ago, but it's really not a very big deal. Of course, I don't know how in-depth your evaluation requirements are, but I imagine they can't be all that intense if you were using something like SQL Server in the past.

.NET also has VBScript and JScript support; both of these scripting languages have built-in expression evaluation (check out the "eval" function in JScript). If you can call that stuff, you're probably golden.

Regards,

Jeff Varszegi
GeneralRe: Evaluating expressions Pin
Yaron K.25-Apr-04 20:45
Yaron K.25-Apr-04 20:45 
GeneralRe: Evaluating expressions Pin
Jeff Varszegi25-Apr-04 21:01
professionalJeff Varszegi25-Apr-04 21:01 
GeneralRe: Evaluating expressions Pin
Yaron K.26-Apr-04 1:35
Yaron K.26-Apr-04 1:35 
GeneralRe: Evaluating expressions Pin
Jeff Varszegi25-Apr-04 22:45
professionalJeff Varszegi25-Apr-04 22:45 
GeneralRe: Evaluating expressions Pin
Heath Stewart26-Apr-04 3:13
protectorHeath Stewart26-Apr-04 3:13 
GeneralClass Circular References Pin
Abner Mallidy25-Apr-04 18:40
Abner Mallidy25-Apr-04 18:40 
GeneralRe: Class Circular References Pin
Jeff Varszegi25-Apr-04 19:55
professionalJeff Varszegi25-Apr-04 19:55 
Questionhow to draw on a bitmap? Pin
lowiq25-Apr-04 18:08
lowiq25-Apr-04 18:08 
AnswerRe: how to draw on a bitmap? Pin
CWIZO25-Apr-04 21:25
CWIZO25-Apr-04 21:25 
GeneralRe: how to draw on a bitmap? Pin
lowiq25-Apr-04 21:58
lowiq25-Apr-04 21:58 
GeneralRe: how to draw on a bitmap? Pin
Heath Stewart26-Apr-04 3:08
protectorHeath Stewart26-Apr-04 3:08 
GeneralRe: how to draw on a bitmap? Pin
lowiq26-Apr-04 19:48
lowiq26-Apr-04 19:48 
GeneralRe: how to draw on a bitmap? Pin
Heath Stewart27-Apr-04 2:49
protectorHeath Stewart27-Apr-04 2:49 
GeneralRe: how to draw on a bitmap? Pin
lowiq27-Apr-04 3:47
lowiq27-Apr-04 3:47 
GeneralFormula Pin
DucLinh25-Apr-04 15:39
DucLinh25-Apr-04 15:39 
GeneralRe: Formula Pin
Nick Parker25-Apr-04 15:53
protectorNick Parker25-Apr-04 15:53 
GeneralRe: Formula Pin
Werdna25-Apr-04 17:19
Werdna25-Apr-04 17:19 
GeneralRe: question Pin
Nick Parker25-Apr-04 15:39
protectorNick Parker25-Apr-04 15:39 
GeneralRe: question Pin
Steve McLenithan25-Apr-04 16:24
Steve McLenithan25-Apr-04 16:24 
GeneralRe: question Pin
Heath Stewart25-Apr-04 17:52
protectorHeath Stewart25-Apr-04 17:52 
GeneralRe: question Pin
Steve McLenithan26-Apr-04 6:38
Steve McLenithan26-Apr-04 6:38 
GeneralRe: question Pin
Nick Parker25-Apr-04 17:45
protectorNick Parker25-Apr-04 17:45 
GeneralRe: question Pin
osto25-Apr-04 16:53
osto25-Apr-04 16:53 
GeneralcheckedListBox Line Spacing Pin
interlocked25-Apr-04 13:42
interlocked25-Apr-04 13:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.