Editor: This is a set of PHP functions that convert boolean syntax (such as "dogs" and "cats" not "mammoth") into SQL statements that can be run as a database query. I didn't do much in the way of sanitization here, any programmer using this is expected to sanitize his input before feeding it to this function. No excuses.
Update: This script has now been translated to work under ASP as well. Thanks to the user who goaded me into finally getting that done, I had intended to it years ago. The ASP version hasn't been tested as thoroughly as the PHP version, but appears to be outputting identical output for a given input. Source is at the bottom of the page.