How to automatically parenthesize an arbitrary Julia expression
问题 Given a syntactically valid, but otherwise arbitrary, Julia expression, such as 3 - 4 > 1 & 2 + 2 == 4 | 10 - 5 > 2 or 2 + 9 - 8 * 8 ^ 7 / 2 == 8 + 8 / 1 ^ 2 ...is there a convenient way to fully parenthesize the expression in a way consistent with Julia's standard parsing of it? One approach that won't go far enough: julia> parse("3 - 4 > 1 & 2+2 == 4 | 10 - 5 > 2") :(3 - 4 > 1 & 2 + 2 == (4 | 10) - 5 > 2) julia> parse("2 + 9 - 8 * 8 ^ 7 / 2 == 8 + 8 / 1 ^ 2") :((2 + 9) - (8 * 8^7) / 2 == 8