pseudocode for infix to postfix translator !(p^q)=(!pv!q) would go to pq^!p!q!v= for each chr in the input { switch(chr) { case p,q,r,s: add to output case (,!: push case v,^,>,=: if stack has any unary or binary relation other than =, pop to output, then push case ): pop to output till (, then pop } } empty stack to output