Declare BinaryTreeNode result;
While there are tokens to be read:
	Read a token.
	If the token is a number, then add it to the output stack.
	If the token is an operator, o1, then:
		while there is an operator token, o2, at the top of the operator stack, and
		o1 has precedence less than or equal to that of o2,
			operator = pop o2 off the operator stack;
			if result is null:
				set result's data to operator
				set result's left child to output stack pop()
				set result's right child to output stack pop()
			else 
				BinarTreeNode right = result;
				result = new BinaryTreeNode
				set result's data to operator
				set result's right to right
				set result's left to output stack pop()
		push o1 onto the operator stack.
When there are no more tokens to read:
	While there are still operator tokens in the stack:
		if result is null:
			set result's data to operator
			set result's left child to output stack pop()
			set result's right child to output stack pop()
		else 
			BinarTreeNode right = result;
			result = new BinaryTreeNode
			set result's data to operator
			set result's right to right
			set result's left to output stack pop()
Return result