Commit 909e8f12 authored by Raphaël Rieu-Helft's avatar Raphaël Rieu-Helft

Fix while loops

parent 2929bbc2
......@@ -115,7 +115,7 @@ void lsld(uint32_t * low, uint32_t * high, uint32_t x, uint32_t cnt)
"(uint32_t)(((uint64_t)%1 | ((uint64_t)%2 << 32))/(uint64_t)%3)"
syntax val lsl "%1 << %2"
syntax val rsl "%1 >> %2"
syntax val lsr "%1 >> %2"
end
......
......@@ -599,8 +599,13 @@ module Translate = struct
begin match cs with
| C.Sexpr ce -> cd, C.Swhile (ce, C.Sblock b)
| _ ->
let s,e = C.get_last_expr cs in
cd, C.Sseq (s, C.Swhile (e, C.Sblock b))
begin match C.get_last_expr cs with
| C.Snop, e -> cd, C.(Swhile(e, C.Sblock b))
| s,e -> cd, C.(Swhile(Econst (Cint "1"),
Sseq(s,
Sseq(Sif(Eunop(Unot, e), Sbreak, Snop),
C.Sblock b))))
end
end
| Etry (b, exm) ->
Format.printf "TRY@.";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment