logoalt Hacker News

jeroenyesterday at 10:49 AM2 repliesview on HN

If we actually (as the title seems to imply) invert the parentheses, then for your example we get 1+2)*(3 .

Now all you need are the opening and closing parentheses at the start and end, and we're back to normal.


Replies

suniryesterday at 3:05 PM

Thank you. I thought I was going crazy reading the article which doesn’t connect open and close parenthesis :: higher and lower precedence :: indent and outdent :: +1 and -1 and just flip it around to get the opposing polarity.

A real Wesley Crusher moment.

swiftcoderyesterday at 11:22 AM

Yeah, that seems a much more robust formulation of the whole thing. Flip all parens and enclose the whole string in more parens.

show 1 reply