Exercise 6:

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. Recall that 1, 4*1*8, 1+2*3*4, 1*2+3*4+5 are correct but *, 3+, +*, 1 2, *0, 7*0*7* are not. The generated AST must correspond to an interpretation of both + and * as a left-associative operators. The usual precedence of * over + 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.