Figure 2: Pseudo-code for tree construction


Build_Expression
1. Push a Start_Obj onto the Operator Stack
2. For each expression object in the expression string (from left to right)
		a. Create an expression object according to the current token information
		b. Build( newly created expression object )
Build( Current Expression Object )
1. If the Current Expression Object is of the OPERAND_TYPE,
		Push the object onto the Expression Stack.
	Else If the Current Expression Object's type is BINARY_OPERAND_TYPE, UNARY_OPERAND_TYPE, or OPEN_PAREN_TYPE
		a. Pop an object off the Operator Stack and store it in Operator_Obj
		b. If Operator_Obj's type is OPEN_PAREN_TYPE,
				Priority1 = 0
			Else If Operator_Obj's type is CLOSE_PAREN_TYPE,
				Priority1 = -1;
			Else Priority1 = Operator_Obj's Priority
		c. Priority2 = Current Expression Object's Priority
		d. While Priority1 >= Priority2
				Push Operator_Obj onto Expression Stack
				Repeat Steps 1a and 1b
		e. Push Operator_Obj onto Operator Stack
		f. Push Current Expression Object onto Operator Stack
	Else If Current Expression Object is CLOSE_PAREN_TYPE,
		Until an object with the OPEN_PAREN_TYPE is reached,
			Pop objects off the Operator Stack and Push them onto the Expression Stack
	Else If Current Expression Object is STOP_TYPE
		Pop the remaining objects off of the Operand Stack and push them onto the Expression Stack.