[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 = x + 2 in x end Not derivable
- let x = 1 in y end Derivable
- let x = 1 in x end + let y = x in y end Not derivable (declaration y = x is not allowed)
- let x = 1 + y = 2 in x + y end Not derivable