parse a query string just using the stack