I'm writing a .NET program that does a lot of string validation of text files. I want to allow the user to be able to set up validation rules so I don't have to hard code lots of edge cases. For example I envision something like the following (caps are items in drop downs to limit user operations and items in quotes are user written):
IF KEY IS "X" AND VALUE IS "Y" RETURN NOTIFICATION
(IF KEY IS "X" OR VALUE IS "Y") AND (IF SECTIONNAME IS "I") REPLACE "Y" WITH "J"
So as you can see above I want to be able to group things with parens, use logical AND and OR and process IF statements which will all evaluate to some True/False value to perform some action. My question is what's the best way to parse the data so that I know the right operations to perform and in the correct groupings. Through Google it seems that perhaps I'm wanting to create an abstract syntax tree, if that's the case I've not been able to find some simple examples to really get me started.
Any help is greatly appreciated!