18 lines
333 B
OCaml
18 lines
333 B
OCaml
|
open Spice.Bcg
|
||
|
open Spice.Bcg.B.Infix
|
||
|
|
||
|
let () =
|
||
|
Logs.set_reporter (Logs.format_reporter ());
|
||
|
Logs.set_level (Some Logs.Debug);
|
||
|
|
||
|
let main =
|
||
|
(B.if_ (`R 1)
|
||
|
(B.mov (`R 0) (B.int 5))
|
||
|
(B.mov (`R 0) (B.int 6))
|
||
|
)
|
||
|
+> B.mul (`R 0) (B.int 2)
|
||
|
|> B.ret (`R 0)
|
||
|
in
|
||
|
|
||
|
Logs.debug (fun m -> dump (m "%s") main);
|