Inverse Parentheses: A Wild Programming Language Idea
The Comic

Page 1: Nobita proposes the revolutionary idea of inverse parentheses

Page 2: Doraemon explains the technical approach using tokenization

Page 3: The team explores alternative solutions and practical concerns

Page 4: Despite challenges, the exploration leads to interesting discoveries
What's This About?
A fascinating discussion emerged on Hacker News about a unconventional programming language concept: inverse parentheses. While normal parentheses like (1 + 2) group expressions and increase their precedence, what if we had brackets that decrease precedence instead?
The author proposes a tokenizer-based solution that assigns "friendliness scores" to tokens based on their nesting depth. This creates infinitely many precedence levels using a precedence climbing parser. The result? Delightfully inverted behavior where (1 + 2) * 3 becomes equivalent to 1 + 2 * 3, and vice versa.
The Hacker News Discussion
The HN community had varied reactions to this idea, which we've personified as Doraemon characters:
The Technical Critics (Dekisugi): Several commenters pointed out fundamental ambiguities in the proposal. When you reduce an operator's precedence with arbitrary operators having different precedences and associativity, where exactly does it land in the hierarchy? For example, with a(*) b + c, should the inverse operator have the same precedence as addition, or create a new intermediate level?
The Alternative Thinkers (Shizuka): Some suggested reframing the concept. One commenter noted this could be modeled as "operators with negated binding precedence" - essentially syntactic sugar for precedence manipulation. Others drew parallels to Haskell's $ operator, which similarly reduces function application precedence.
The Practical Critics (Suneo): Multiple users complained about clarity issues in the original article, noting it needed clearer motivating examples explaining what "ungrouping operands" actually means in practice. Others reported technical problems with the demo page, including CSS-related scrolling bugs on Safari and Brave browsers.
The Radical Alternatives: Some suggested that languages using pure left-to-right evaluation (like Smalltalk) eliminate this entire problem - though that would require "unlearning primary school mathematics."
The Takeaway
While the inverse parentheses concept faces significant practical challenges - particularly around operator precedence ambiguity - the exploration itself proved valuable. As one insight noted, reversing the "friendliness calculation" yields an ordinary parser, suggesting this approach provides a flexible foundation for exploring unconventional syntactic structures.
Sometimes the wildest ideas, even if they don't work perfectly, lead to the most interesting discoveries about how we think about programming language design.
Read the Original Discussion
Check out the full Hacker News discussion with all 28 comments:
Inverse Parentheses on Hacker News
And read the original article:
Inverse Parentheses by Kellett
Top comments (0)