Take binary operator ~ and a chain like a ~ b ~ c. It is ambiguous as it can mean either of:
(a ~ b) ~ ca ~ (b ~ c)
That is to say, expressed in infix notation, the expression is ambiguous when the parentheses are omitted.
Written in Polish/prefix notation however, there is no ambiguity even if we omit the parentheses:
(a ~ b) ~ cbecomes~(~(a b) c)which without parentheses is~~abca ~ (b ~ c)becomes~(a ~(b c))which without parentheses is~a~bc
Are there scenarios where Polish/prefix notation can be ambiguous?
I went over all permutations of ~~abc trying to find an ambiguous Polish/prefix notation expression, but none were ambiguous:
ab~c~ # invalid, string must start with `~`
abc~~ # invalid, string must start with `~`
~a~bc # This is #2 above.
a~b~c # invalid, string must start with `~`
ab~~c # invalid, string must start with `~`
~~abc # This is #1 above.
~abc~ # invalid, string cannot end with `~`
a~bc~ # invalid, string must start with `~`
~ab~c # invalid, the second `~` only has one operand
a~~bc # invalid, string must start with `~`
I have tested only the bare minimum (a chain of two applications of the binary operation); I could try three, four, etc, but probably someone here knows the answer.