Question: Question 3 (8 points) (a) In the imperative expression language Imp (Lab 6 and HW6), the semantics of seq expression is defined as follows: Evaluating

Question 3 (8 points) (a) In the imperative expression language Imp (Lab 6 and HW6), the semantics of seq expression is defined as follows: "Evaluating (seq e1 e2) evaluates e 1 and then e2, and yields the value of e2." Since only e2's value is needed, can we change its semantics to "The (seq e1 e2) expression evaluates e2 and yields its value" (in other words, skipping the step of evaluating e1)? Explain your answer succinctly, use examples if necessary. (b) Similarly, in the ToyLang language (Lab 9 and HW9), the typing rule for the seq expression says: "A seq expression (seq e1 e2) is well-typed and has type ty if both e 1 and e2 are all well-typed, and e2 has the type ty." Since only e2's type is needed, can we change this typing rule to skip the checking on e1? Explain your answer succinctly
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
