Penguin
Diff: ReversePolish
EditPageHistoryDiffInfoLikePages

Differences between version 7 and revision by previous author of ReversePolish.

Other diffs: Previous Major Revision, Previous Revision, or view the Annotated Edit History

Newer page: version 7 Last edited on Saturday, November 1, 2003 2:28:56 pm by AristotlePagaltzis Revert
Older page: version 1 Last edited on Sunday, February 9, 2003 10:28:24 pm by GlynWebster Revert
@@ -1,35 +1,44 @@
-Style of syntax used for writing expressions: 
+Styles of syntax used for writing expressions or tree-structured data
  
-* In __ infix__ notation you write the operator between the arguments.  
+  
+!!!Infix  
+  
+ In infix notation you write the operator between the arguments:  
  
  c - (5 + a + x) * b 
  
-Infix notation is the usual. It needs precedence rules and/or brackets to make the order of operations unambiguous though . Polish and Reverse Polish don't have that problem, providing the number arguments to each operator is fixed. 
+Infix notation is the usual. It needs precedence rules and/or brackets to make the order of operations unambiguous. Polish and Reverse Polish don't have that problem, providing the number arguments to each operator is fixed.  
+  
+!!!Reverse Polish  
+  
+In Reverse Polish, or __postfix__, notation you write the operator after the arguments
  
-* In __Reverse Polish__, or postfix, notation you write the operator after the arguments.  
+ c 5 a + x + b * -  
  
- c 5 a + x + b * -  
+It's very easy to interpret expressions in this notation, you need just a single stack to place intermediate values on, this is why [Forth] uses it.  
  
-It's very easy to interpret expressions in this notation, you need just a single stack to place intermediate values on, this is why [FORTH] uses it.  
+!!!Polish  
  
-* In __ Polish__ , or prefix, notation you write the operator before the arguments. 
+In Polish, or __ prefix__ , notation you write the operator before the arguments. 
  
  - c * + 5 + a x b 
  
 Polish notation is called that because a famous Polish mathematician first used it for Boolean algebra, and nobody can either remember or pronounce his name without looking it up first. (''You'' go look it up.) 
  
+!!!S-expressions  
  
-* In __ S-exp__ , or [Lisp ], notation you write the operator before the arguments, enclosed in brackets.  
+In S-expression , or [LISP ], notation you write the operator before the arguments, enclosed in brackets:  
  
  (- c (* (+ 5 a x) b)) 
  
-[Lisp ] operators take any number of arguments so [Lisp ] expressions need brackets to associate arguments with operators. 
+[LISP ] operators take any number of arguments so [LISP ] expressions need brackets to associate arguments with operators. 
  
-It's very easy to parse this notation into tree structures, which is why Lisp uses it. 
+It's very easy to parse this notation into tree structures, which is why [LISP] uses it. 
  
+!!!XML  
  
-* In __ XML__ notation you bracket the arguments with the operator: 
+In XML notation you bracket the arguments with the operator: 
  
  <subtract> 
  <variable name="c"/> 
  <multiply>