summary refs log tree commit diff
diff options
context:
space:
mode:
authorPaweł Dybiec <pdybiec@stud.cs.uni.wroc.pl>2018-12-10 16:32:32 +0100
committerPaweł Dybiec <pdybiec@stud.cs.uni.wroc.pl>2018-12-10 16:32:32 +0100
commitb7a4e03d3d9d836f6ec094deec299e3056758e87 (patch)
treec2a9d08288a5812eb7d41d29e751bf1c3794c1a0
parentFix assignment and string issue (diff)
While
-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