while!thestack isempty(/pop remaining opers thestack displaystack("while ")/*diagnosticoutput output thestack pop()/write to output thestack displaystack("end ")/*diagnosticreturn output/return postfix /end dotrans(//public void gotoper(char opthisint prec /got operator from input while!thestack isempty(char optop thestack pop()ifoptop ='(/if it' '(thestack push(optop)/restore '(breakelse /it' an operator int prec /precedence of new op less if(optop=='+|optop=='-'/find new op prec prec else prec if(prec prec /if prec of new op /than prec of old thestack push(optop)/save newly-popped op breakelse /prec of new not less output output optop/than prec of old /end else (it' an operator/end while thestack push(opthis)/push new operator /end gotop(//public void gotparen(char ch/got right paren from input while!thestack isempty(char chx thestack pop()ifchx ='(/if popped '(break/we're done