UndertaleModTool icon indicating copy to clipboard operation
UndertaleModTool copied to clipboard

Decompiler parenthesis cleanup

Open Jacky720 opened this issue 1 year ago • 1 comments

Description

Attempt to severely reduce the number of parentheses produced by the decompiler, especially when handling math and comparison expressions.

Caveats

Each aspect has been tested, but I could be missing complex order-of-operations edge cases where the removed parentheses are required. I think that in that event, it's still preferable to handle those cases as they arise rather than continue with the current state.

Notes

I may re-add decompiler rounding (numbers like 0.2 currently decompile as 0.20000000000000001 due to floating-point restrictions) to this branch later.

Fixes #1032

Jacky720 avatar Feb 08 '24 03:02 Jacky720

This seems to ignore that subtraction and diviison aren't commutative; a = b - (c - d) gets decompiled as a = b - c - d, which is different.

CST1229 avatar Apr 07 '24 12:04 CST1229

compiling fails

Miepee avatar Apr 07 '24 14:04 Miepee

Wow, you both got here quick. Does the new commit fix it?

Jacky720 avatar Apr 07 '24 14:04 Jacky720

Wow, you both got here quick. Does the new commit fix it?

Yep.

CST1229 avatar Apr 07 '24 14:04 CST1229