This site uses cookies only for the purpose of identifying user sessions.
This is required to properly register actions.
Exercise
‹15›:
Expressions over unary signs and ^
The set of tokens of the language is
{+,-,^,NUMBER}. The token NUMBER
represents unsigned integers, i.e., non-empty sequences of digits. Recall that
1,+2, 3^4^5 and -6^-7 (even strange expressions
like --8^+++9, which is equivalent to 8^9), are correct, whereas
+, 1+2, 3^, 1 2 are not. The generated AST must
correspond to an interpretation of ^ as a right-associative with lower
precedence than the unary operators. For example, for input -1^2^+3 the
resulting AST must be ^(-(1),^(2,+(3))), i.e., like if the implicit
parenthesization was (-1)^(2^(+3)).
Authors: Carles Creus, Guillem Godoy, Nil Mamano
/
Documentation: