The double entry writing style, also known as Knuth-Schützenberger priority or reverse Polish notation, is a method of parsing mathematical expressions in which operators are placed after their operands. This unique approach offers several benefits, including the ability to omit parentheses and improved legacy code readability. Let's delve into this distinctive style, explore its advantages, and understand how it works.

In traditional mathematical notations, expressions are written using infix notation. For instance, the expression "3 + 4" would be written as "3 + 4". However, in double entry notation, the expression is written as "3 4 +", where the operator ('+') follows its operands ('3' and '4').

The Parse Tree
The parse tree is a critical concept in understanding the double entry style. It represents a hierarchical structure of nodes, where internal nodes are operators, and leaf nodes are operands. In the '3 4 +' expression, '+' would be the root (internal node), and '3' and '4' would be the leaf nodes.

Douglas Hofstadter and Giorgio Cody, in their paper "Tan: A Better Look at Reverse Polish Notation," demonstrate how parse trees can simplify parenthesis-free expressions, contributing to the appeal of double entry notation.
Operator Precedence and Associativity

In double entry, the order of operations is implicitly defined by the order of operands and operators, eliminating the need for explicit rules like BODMAS (Brackets, Orders, Division and Multiplication, Addition and Subtraction).
Moreover, the associativity of operators is inherently handled. For example, '5 2 + 3 *' becomes '(5 + 2) * 3' in infix notation, demonstratingdouble entry's ability to preserve mathematical intent without parentheses.
Improved Code Readability

Legacy code often contains expressions with numerous nested parentheses, making it challenging to understand. Double entry notation can simplify such expressions. For instance, '(A + B) * (C - D) + E' can be written as 'A B + C D - * E +'.
This rewrite reduces visual clutter, improving the code's readability and maintainability.
Applications and Limitations

Double entry notation finds applications in computer languages like APL and PostScript. It also simplifies stack-based architectures in programming, where operators are applied to the top values of the stack.
However, double entry notations are not without limitations. Despite its advantages, it may not be suitable for broader adoption due to a lack of immediate intuitive appeal. The learning curve for those unfamiliar with the method can be steep.










Learning Double Entry Notation
To learn the double entry style, start by practicing with simple arithmetic expressions. Gradually incorporating parentheses manipulation, predictors, and negators like unary minus. Resources like Hofstadter and Cody's paper and Peter Landin's "The Next 700 Programming Languages" can offer deeper insights.
Websites and communities dedicated to programming languages using double entry notation, like APL and J, can also provide valuable learning experiences.
In conclusion, while the double entry writing style may not be universally adopted, its unique benefits, such as eliminating parentheses and improving legacy code readability, make it a valuable addition to the programmer's toolkit. Embracing this style, despite its learning curve, can expand one's understanding of mathematical expressions and programming concepts.