Sounds like homework :) In a complex project like this, it is best to break it down into managable steps. The general steps to take are
- Lexing: decide what the tokens are
- Create a grammar for your search expressions, using tokens as your terminal elements
- Code up a parser - recursive descent would work here
- Run the expression through the parser, creating a parse tree
- Walk the parse tree, executing search code
I can't make sense of the detailed requirements you state, but depending on what they are, you might be able to take some shortcuts. For instance, if the column names and corresponding values are always alphanumeric, these would be easy to distingush from the logical and grouping tokens of a search expression. Also, your task is simple enough that the parsing and executuion steps can be combined (look up syntax-directed translation in your book).