Give a CFG that accepts arithmetic expressions that are written in the Reversed Polish Notation (RPN) and convert it to a PDA. We will restrict its operations to digits only (0, …9) and operators (+, −, ×, ÷). We would like to recognise whether an expression is a legitimate RPN expression. We are not interested in calculating the results.
Reverse Polish Notation (RPN) is an unambiguous, parenthesis-free notation for arithmetic expressions, for example:
Infix expression A + (B * C) is written as A B C * +.
Infix expression (A + B) * C is written as A B + C * or as C A B + *.