// convert2postfix converts an infix expression to postfix
convert2postfix converts an infix expression to postfix
// convert2postfix converts an infix expression to postfix
func convert2postfix(tokens []string) []string {
	var stack stack.Stack
	var result []string
	for _, token := range tokens {
		stackString := fmt.Sprint(stack) 
		stackString += ""                
		if isOperator(token) {
		OPERATOR:
			for {
				top, err := stack.Top()
				if err == nil && top != "(" {
					if opGTE(top.(string), token) {
						pop, _ := stack.Pop()
						result = append(result, pop.(string))
						continue
					} else {
						break OPERATOR
					}
				}
				break OPERATOR
			}
			stack.Push(token)
		} else if isFunction(token) {
		FUNCTION:
			for {
				top, err := stack.Top()
				if err == nil && top != "(" {
					if opGTE(top.(string), token) {
						pop, _ := stack.Pop()
						result = append(result, pop.(string))
					}
				} else {
					break FUNCTION
				}
				break FUNCTION
			}
			stack.Push(token)
		} else if token == "(" {
			stack.Push(token)
		} else if token == ")" {
		PAREN:
			for {
				top, err := stack.Top()
				if err == nil && top != "(" {
					pop, _ := stack.Pop()
					result = append(result, pop.(string))
				} else {
					stack.Pop() 
					break PAREN
				}
			}
		} else if isOperand(token) {
			result = append(result, token)
		} else if isSymbol(token) {
			result = append(result, symbolTable[token])
		} else {
			result = append(result, token)
		}
	}
	for !stack.IsEmpty() {
		pop, _ := stack.Pop()
		result = append(result, pop.(string))
	}
	return result
}
func convert2postfix ( tokens [ ] string ) [ ] string { var stack stack . Stack var result [ ] string for _ , token := range tokens { stackString := fmt . Sprint ( stack ) stackString += " " if isOperator ( token ) { OPERATOR : for { top , err := stack . Top ( ) if err == nil && top != " " { if opGTE ( top . ( string ) , token ) { pop , _ := stack . Pop ( ) result = append ( result , pop . ( string ) ) continue } else { break OPERATOR } } break OPERATOR } stack . Push ( token ) } else if isFunction ( token ) { FUNCTION : for { top , err := stack . Top ( ) if err == nil && top != " " { if opGTE ( top . ( string ) , token ) { pop , _ := stack . Pop ( ) result = append ( result , pop . ( string ) ) } } else { break FUNCTION } break FUNCTION } stack . Push ( token ) } else if token == " " { stack . Push ( token ) } else if token == " " { PAREN : for { top , err := stack . Top ( ) if err == nil && top != " " { pop , _ := stack . Pop ( ) result = append ( result , pop . ( string ) ) } else { stack . Pop ( ) break PAREN } } } else if isOperand ( token ) { result = append ( result , token ) } else if isSymbol ( token ) { result = append ( result , symbolTable [ token ] ) } else { result = append ( result , token ) } } for ! stack . IsEmpty ( ) { pop , _ := stack . Pop ( ) result = append ( result , pop . ( string ) ) } return result }
convert2postfix converts an infix expression to postfix
convert2postfix converts an infix expression to postfix
// HACK - debugging // HACK - debugging // pop off "("