Exercise 18:

Parenthesized expressions over unary signs and binary +, -, and ^ (^ with highest precedence)
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 whereas are not. The generated AST must correspond to an interpretation of the + and - binary operators as left-associative and exponentiation as right-associative. The precedence differs from the usual in that exponentiation has more precedence than unary operators. As an example, for input
the resulting AST must be
i.e., as if the implicit parenthesization was
Authors: Nil Mamano / Documentation:
To be able to submit you need to either log in, register, or become a guest.