Thread with 3 posts

jump to expanded post

#wikifinds

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.”[8]

Open thread at this post