RISC code output

TODO: fix wrong order for conversion in cfgrisc
This commit is contained in:
elvis
2024-12-01 12:55:20 +01:00
parent 08f0eb5c91
commit 52cd7e7e13
7 changed files with 332 additions and 11 deletions

View File

@ -1,11 +1,22 @@
open MiniImp
let () =
(* let program = "def main with input x output y as *)
(* x := 2; *)
(* if y < 0 then ( *)
(* y := x + 3; *)
(* x := y; *)
(* ) else *)
(* x := 1 - y;" in *)
let program = "def main with input x output y as
x := 2;
if y < 0 then (
y := x + 3;
x := y;
if x > 0 then
x := y;
else
x := y + 1;
) else
x := 1 - y;" in
@ -19,4 +30,6 @@ let () =
let convertedrisccfg = CfgRISC.convert convertedcfg in
Printf.printf "%a" CfgRISC.RISCCfg.pp convertedrisccfg
let risc = RISC.convert convertedrisccfg in
Printf.printf "%a" RISC.RISCAssembly.pp risc