Assume we add a new kind of looping statement, the exit-when loop. This loop is of the form
First statements1 are executed. Then expression is evaluated. If it is true, the loop is exited. Otherwise, statements2 followed by statements1 are executed. Then expression is reevaluated, and the loop is conditionally exited. This process repeats until expression eventually becomes true (or else the loop iterates forever). Suggest an AST structure suitable for representing an exit-when loop.
Define a code generator for this AST structure. (You may generate JVM code or code for any other computer architecture).