[Points 4]
Consider the mini language of expressions seen in class, defined by the grammar
Exp ::= Num | Ide | Exp Op Exp | let Ide = Num in Exp end
Op ::= + | * | - | /
where Num and Ide are defined as usual. For each of the following expressions, say
whether or not they are derivable from this grammar. (Note: you are not requested to say whether
an expression is "correct", but only whether it can be derived from the grammar.)
- let x = 1 in let x = 2 in x end Not derivable
- let x = 1 + 2 in x end Not derivable (declaration x = 1 + 2 not allowed)
- x + let x = 1 in x end Derivable
- let x = 1 in x + let y = 1 in x end end Derivable