postfix to infix by ksk

open String
let i=ref 0
let rec(@)s?(o=decr i;make 1s.[!i])?(r=8+index("+-*/"^o)o.[0])p=if o>"/"then o
else
let l=(s@r-1)^o^s@r in[|"("^l^")";l|].(r/2*2/p)and
g?(s=read_line())_=g(i:=length s;print_endline(s@8));;g()

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page