A repeat-until statement is a loop much like
the while-statement, except that the test for exiting the loop
is performed at the end of the loop rather than at the beginning.
For example, the code for the body in the following loop would
execute exactly once if x began with a value of -2, and would execute
exactly three times if x began with a value of 5.
repeat
-
x = x - 2;
until (x < 0)
Suppose a repeat-until statement were added to the C- language.
-
Describe an appropriate (intermediate or target) code arrangement
for a repeat-until statement.
-
Show a sequence of 3-address code instructions that is consistent
with your answer to part a and implements the repeat-until statement
shown above.
-
Show a sequence of BVM-like intermediate code instructions that
is consistent with your answer to part a and implements the
repeat-until statement shown above.