This site uses cookies only for the purpose of identifying user sessions.
This is required to properly register actions.
Exercise
‹7›:
Expressions over binary + and * (with AST +(1,2,*(3,4,5)) for 1+2+3*4*5)
The set of tokens of the language is
{+,*,NUMBER}. The token NUMBER represents
unsigned integers, i.e., non-empty sequences of digits. Recall that 4,
2*4*5, 1+2*3*4, 1*2+3*4+5 are correct but *,
6+, +*, 1 2, *3, 1*2*3* are not. The
generated AST must have at most one symbol + that will be the root, and
only one * for every product. 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), whereas 1 has AST 1 and
1*2*3 has AST *(1,2,3).
Authors: Pau Fernández
/
Documentation: