Exercise 10:

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 0, 4+2/0, 1-2+3*4, 5/6/7, whereas 1+, /8, 1 2, -1, 2/3*4+ are not. The generated AST must correspond to an interpretation of all operators as left-associative. The usual precedence of products and divisions over sums and subtractions applies. For example, for input 1+2*3/4-5 the resulting AST must be -(+(1,/(*(2,3),4)),5), i.e., as if the implicit parenthesization was (1+((2*3)/4))-5.
Authors: Pau Fernández / Documentation:
To be able to submit you need to either log in, register, or become a guest.