parses basic queries constructs an AST