summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/mod_student/translator.ml11
1 files changed, 11 insertions, 0 deletions
diff --git a/source/mod_student/translator.ml b/source/mod_student/translator.ml
index 898ab5b..6eff46f 100644
--- a/source/mod_student/translator.ml
+++ b/source/mod_student/translator.ml
@@ -290,6 +290,17 @@ module Make() = struct
set_jump else_bb end_bb;
end_bb,env
+ | STMT_While {cond;body;_} ->
+ let check=allocate_block() in
+ let body_bb=allocate_block() in
+ let after=allocate_block() in
+ set_jump current_bb check;
+ let check2 = translate_condition env check after cond in
+ set_jump check2 body_bb;
+ let body_bb,_ =translate_statement env body_bb body in
+ set_jump body_bb check;
+ after,env
+
| STMT_Block block ->
let env,bb=translate_block env current_bb block