3 ms·
Ha, yup. I think a good corollary is prefix vs. infix notation in programing languages. With prefix (or RPN) notation, it's impossible to be led down the garden
by function_seven 11y ago
Ha, yup. I think a good corollary is prefix vs. infix notation in programing languages. With prefix (or RPN) notation, it's impossible to be led down the garden path. The rules are simple and unambiguous.
For example, 4+5×3 is a garden path, where reading left-to-right you may think to yourself, "four plus five is nine, then nine times... wait, I have to backtrack and handle five times three first..."
Whereas + 4 × 5 3 can't be confused. (Or 4 5 3 × + in RPN)
I'm not a (good) speaker of any other language than English, but I can see how adjective/verb/noun ordering in different languages can prevent this problem.
- TazeTSchnitzel 11y agoRPN does have the advantage that it's unambiguous, yes, but if you miss a token you will end up confused.
- jjnoakes 11y agoWon't you be confused if you miss a token in a non-RPN parse?
- TazeTSchnitzel 11y agoYes, but the difference is less drastic.
- jloughry 11y agoAnd this sentence: The girl the boy the dog hit bit cried. measures the depth of the stack in human brains.
- mikeash 11y agoI think I've suffered an overflow, and I bet it's exploitable too.
- function_seven 11y agoYeah, it exceeded my own stack :). Is it, "The boy hit the dog, the dog then bit the girl, who then cried?" Some of those verbs are binary operators (transitive), others are unary (intransitive).
- jloughry 11y agoArgh! You're right; I got the words out of order. It should be: The girl the boy the dog bit hit cried. I tried parenthesising it; I tried Lisp syntax (you're right; it's the mix of direct and indirect objects that complicates things); nothing worked. It's a diabolical sentence. The best I could come up with was this: In step 1, the dog bit the boy. In step 2, the boy hit the girl. In step 3, the girl cried.