This site uses cookies only for the purpose of identifying user sessions.
This is required to properly register actions.
Parenthesized 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. The
expressions 9, 3*(2+1), (2+5)*1+4 and 1*(2+3)*4+5
are correct but *, )1+, +(*), 1 2, *3,
()), 2*3*(3*) are not. The generated AST must correspond to an
interpretation of both + and * as a left-associative operators,
and should discard the parentheses. The usual precedence of * over
+ applies. For example, the input (1+2+3)*4+5*6*7 must produce
the AST +(*(+(+(1,2),3),4),*(*(5,6),7))
Authors: Pau Fernández
/
Documentation: