Skip to content

[bug] Reserve grouping in expression display #129

Open

Description

@GermanHeim

Describe the bug
The renderer in oximo-expr uses precedence alone in places where associativity also matters. For example, x / (y / z) and x / (y * z) lose their denominator parentheses. Also, a power used as another power's base can also lose grouping. This changes the apparent meaning of displayed models and error messages.

A possible solution would be to make the rendering context distinguish the denominator of a division and the base of a power from other operands. Parenthesize compound denominators and nested power bases when omitting parentheses changes the grouping. We can check unary negatives and negative constants used as power bases as well. We need to retain the explicit traversal stack so deeply nested expressions remain stack-safe.

Additional context
This issue is tagged good first issue specifically to help new contributors get hands-on with the codebase and wants to contribute in the long term. Please do not use AI for this issue.

Activity

  1. added
    bug
    good first issue
    on Nov 1, 2026
  2. ShahadatTest commented on Nov 3, 2026

    @ShahadatTest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    buggood first issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions