Implement query parser