This site uses cookies only for the purpose of identifying user sessions.
This is required to properly register actions.
Parenthesized expressions over binary +, -, *, /, and ^
The set of tokens of the language is
{+,-,*,/,^,NUMBER,(,)}.
The token NUMBER represents unsigned integers, i.e., non-empty sequences
of digits. Examples of correct expressions are “1”,
“2+3^4/5”, “1^(0+3)/4-5”, “1/2^3”, whereas
“1+”, “/2”, “1 2”, “^6”, “7/8*9+”
are not. The generated AST must correspond to an interpretation of all
operators as left-associative, except exponentiation, which is
right-associative. The usual precedence of exponentiation over products and
divisions and these over sums and subtractions applies. As an example, for
input
1+2*3^4/5-6
the resulting AST must be
-(+(1,/(*(2,^(3,4)),5)),6)
i.e., as if the implicit parenthesization was
(1+((2*(3^4)/5))-6
Authors: Pau Fernández
/
Documentation: