Implementing my own parser for simple SQL-like query language was easy with Parse::RecDescent. Then you can build a nested structure with callbacks so you can even test the statement with different values.
Comment on Re: Parsing a boolean search string for SQL query