Remix.run Logo
carderne 11 hours ago

I was hoping the parentheses themselves would be flipped. Like this:

> 1 + )2 * 3(

(1 + 2) * 3

AmbroseBierce 11 hours ago | parent | next [-]

I think surrounding the operand would make slightly more sense, as in 1 + 2 (*) 3 as if it's a "delayed form" of the operation that it represents.

SyzygyRhythm 10 hours ago | parent [-]

If you do both (use flipped parentheses around the operators), it makes even more sense, and makes the parsing trivial to boot: just surround the entire expression with parentheses and parse normally. For instance: 1 + 2 )( 3 Becomes (1 + 2 )( 3) Which is actually just what the author wants. You might even want multiple, or an arbitrary numbers of external parentheses. Say we want to give the divide the least precedence, the multiply the middle, and the add the most. We could do that like: 1 + 2 )/( 3 ))(( 4 Surround it with two sets of parens and you have: ((1 + 2 )/( 3 ))(( 4)) I haven't just proved to myself this always does what you expect, though...

dgoldstein0 11 hours ago | parent | prev [-]

Same.

That said if you try to use that with ordinary parentheses usage it would get ambiguous as soon as you nest them

chrisweekly 6 hours ago | parent [-]

Wait, no. It makes no sense to use the same characters! An "inverted" opening parens is visually identical to a "normal" closing parens. IMHO the entire proposition is inane.