This commit is contained in:
Dmitry Boulytchev 2018-03-20 19:32:38 +03:00
parent 8758485b80
commit f8a5e2067a
3 changed files with 10 additions and 3 deletions

View file

@ -1,4 +1,4 @@
TESTS=test001 test002 test003 test004 test005 test006 test007 test008 test009 test010 test011
TESTS=test001 test002 test003 test004 test005 test006 test007 test008 test009 test010 test011 test012
RC=../src/rc.opt

View file

@ -1 +1,8 @@
36
> 0
0
0
1
1
0
1
1

View file

@ -86,7 +86,7 @@ let compile p =
| Stmt.If (c, s1, s2) -> let l2, env = env#get_label in
let env, flag1, s1 = compile' l env s1 in
let env, flag2, s2 = compile' l env s2 in
env, true, expr c @ [CJMP ("z", l2)] @ s1 @ (if flag1 then [] else [JMP l]) @ [LABEL l2] @ s2 @ (if flag2 then [] else [JMP l])
env, true, expr c @ [CJMP ("z", l2)] @ s1 @ (if flag1 then [] else [JMP l]) @ [LABEL l2] @ s2 @ (if flag2 then [] else [JMP l])
| Stmt.While (c, s) -> let loop, env = env#get_label in
let cond, env = env#get_label in