4 ms·
I agree, although I suppose different operators could still have different associativity in a language without precedence. I took that phrasing from the “Puffs
by evincarofautumn 9y ago
I agree, although I suppose different operators could still have different associativity in a language without precedence. I took that phrasing from the “Puffs the Language” documentation.
- masklinn 9y ago> I suppose different operators could still have different associativity in a language without precedence That… is true, and I have a hard time computing how it would even work.
- klodolph 9y agoThink exponentiation, where 2^3^4 might be 2^(3^4), but where subtraction 2-3-4 is (2-3)-4.
- mnarayan01 9y agoConsider: 2-3^4
- irishsultan 9y agoSince there is no precedence in this (hypothetical) language that would be an invalid expression.
- evincarofautumn 9y agoOne way to do it would be to have a default associativity between different operators, but chains of the same operator can override it, e.g. suppose “⧺” means concatenation (rightward), “×” means repetition (leftward), and the default is leftward: [1, 2] ⧺ [3, 4] ⧺ [5, 6] × 2 × 3 (([1, 2] ⧺ ([3, 4] ⧺ [5, 6])) × 2) × 3 [ [ [1…6], [1…6] ], [ [1…6], [1…6] ], [ [1…6], [1…6] ] ] I dunno how good an idea that would be in practice, though.