In a C# app, I would like users to be able to enter search criteria in this kind of format:
(Name = 'Fred' OR Name = 'Jim') AND Age > 30
What I need is some way to parse the input so I can test potential search matches against the criteria. I did experiment with Malcolm Crowe’s compiler tools for .NET years ago, but I’m wondering if there is any new stuff I should be aware of in these days of DSLs and expression trees. What is the best way of approaching this problem?
I’ve been looking at Irony, recently. It’s almost overpowered for what you need, but does fall into the category of “new stuff I should be aware of”.
Here’s an example, using Irony, which seems to do what you require (registration required to read it, though).