學左新既黑魔法
覺得自己algo真係好差
The Fortran I compiler would expand each operator with a sequence of parentheses. In a simplified form of the algorithm, it would
replace + and – with ))+(( and ))-((, respectively;
replace * and / with )*( and )/(, respectively;
add (( at the beginning of each expression and after each left parenthesis in the original expression; and
add )) at the end of the expression and before each right parenthesis in the original expression.
Although not obvious, the algorithm was correct, and, in the words of Knuth, “The resulting formula is properly parenthesized, believe it or not.”