diff options
author | Paweł Dybiec <pdybiec@stud.cs.uni.wroc.pl> | 2018-12-10 16:32:32 +0100 |
---|---|---|
committer | Paweł Dybiec <pdybiec@stud.cs.uni.wroc.pl> | 2018-12-10 16:32:32 +0100 |
commit | b7a4e03d3d9d836f6ec094deec299e3056758e87 (patch) | |
tree | c2a9d08288a5812eb7d41d29e751bf1c3794c1a0 /source | |
parent | Fix assignment and string issue (diff) |
While
Diffstat (limited to 'source')
-rw-r--r-- | source/mod_student/translator.ml | 11 |
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 |