Question: Need help 3. The list iterator of WHILE++, as introduced above, could also be regarded as a mere syntactic extension of WHILE (i.e. syntax sugar).

Need help

Need help 3. The list iterator of WHILE++, as introduced above, could

also be regarded as a mere syntactic extension of WHILE (i.e. syntax

3. The list iterator of WHILE++, as introduced above, could also be regarded as a mere syntactic extension of WHILE (i.e. syntax sugar). To demonstrate this, explain in detail how the command foreach x in E {S} can be translated into WHILE (without list iterators obviously) maintaining its original behaviour (i.e. semantics). Consider all possible forms of appear- ances of the iterator. Explain any assumptions you make. [18 marks] 4. According to the above, can we decide more problems with WHILE++ pro- grams than we can decide with WHILE-programs? Explain your answer briefly. [10 marks) 5. Translate the program prog in Figure 1 into program-as-data notation so that you can use it to test the answer for the next question. Submit this as a text file named progasdata.txt. This file must only contain text (no Word documents here!) representing the program as WHILE++ data. Make sure you follow the specification of WHILE++ programs-as-data format as given further above. [16 marks) prog read L foreach x in L { while XL Y:= cons nil Y; X:= tl x } } } write Y Figure 1: WHILE++-program prog 3. The list iterator of WHILE++, as introduced above, could also be regarded as a mere syntactic extension of WHILE (i.e. syntax sugar). To demonstrate this, explain in detail how the command foreach x in E {S} can be translated into WHILE (without list iterators obviously) maintaining its original behaviour (i.e. semantics). Consider all possible forms of appear- ances of the iterator. Explain any assumptions you make. [18 marks] 4. According to the above, can we decide more problems with WHILE++ pro- grams than we can decide with WHILE-programs? Explain your answer briefly. [10 marks) 5. Translate the program prog in Figure 1 into program-as-data notation so that you can use it to test the answer for the next question. Submit this as a text file named progasdata.txt. This file must only contain text (no Word documents here!) representing the program as WHILE++ data. Make sure you follow the specification of WHILE++ programs-as-data format as given further above. [16 marks) prog read L foreach x in L { while XL Y:= cons nil Y; X:= tl x } } } write Y Figure 1: WHILE++-program prog

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!