As described previously, the branch non-terminal encodes branches. A useful tool for encoding branches is a stack (Table ). A writer begins by pushing the current branch onto the stack and extending it. When a new branch is encountered, it is pushed to the stack and extended. When the branch terminates, the current branch is popped and its contents are appended to the stack's new top item.