Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started