use deque for stack in parser