From b7a4e03d3d9d836f6ec094deec299e3056758e87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Dybiec?= Date: Mon, 10 Dec 2018 16:32:32 +0100 Subject: While --- source/mod_student/translator.ml | 11 +++++++++++ 1 file changed, 11 insertions(+) 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 -- cgit v1.2.3