Path: utzoo!utgpu!water!watmath!clyde!att!rutgers!mit-eddie!uw-beaver!cornell!rochester!pt.cs.cmu.edu!a.gp.cs.cmu.edu!koopman From: koopman@a.gp.cs.cmu.edu (Philip Koopman) Newsgroups: comp.lang.forth Subject: Infix/Postfix notation Keywords: infix, postfix, stacks Message-ID: <2768@pt.cs.cmu.edu> Date: 22 Aug 88 18:59:03 GMT Sender: netnews@pt.cs.cmu.edu Organization: Carnegie-Mellon University, CS/RI Lines: 27 Several recent postings have debated the merits of infix versus postfix notation in Forth. I'd like to present a different viewpoint for discussion. Postfix notation is just a side-effect of a much more important issue: parameter passing for subroutines. One of the most useful aspects of Forth is implicit parameter passing. That eliminates the tedious lists of parameters in parenthesis found in other languages. This makes the code much cleaner and more flexible than other languages. It also makes defining words and immediate words handy. The arithmetic operators are treated as subroutines just like any other word. This allows a blurring of the distinction between hardware supported primitives and high level routines, improving transportability and making optimization of inner loops in assembly language or microcode quite easy. So, to me, the RPN notation is just an inconvenient side-effect of the implicit parameter passing mechanism used by the language, and is not really an important feature itself. As an aside, real infix notation parsers are relatively simple to write (for example, the one Chuck Moore wrote for his tiny BASIC interpretter.) I think that most people don't bother with them because most expressions that are evaluated are very simple. Phil Koopman koopman@faraday.ece.cmu.edu Arpanet Student at CMU, sometime consultant to Harris Semiconductor.