postfix to infix by int-e

m@main=getLine>>=putStrLn.f[]>>m;f z(o:c)|(i,x):(j,y):w<-z,Just k<-lookup o$zip"+- */"[2..]=f((k,(j+1<k)%y++o:(i<k+0^mod k 3)%x):w)c|1>0=f((9,[o]):z)c;f[(_,x)]_=x;t%x|t='(':x++")"|1>0=x

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

download

return to the top page