21 lines
464 B
OCaml
21 lines
464 B
OCaml
open MiniImp
|
|
open MiniImp.CfgImp
|
|
|
|
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 get_result x = Lexing.from_string x |> Parser.prg Lexer.lex in
|
|
|
|
let p = get_result program in
|
|
|
|
let converted = convert p in
|
|
|
|
Printf.printf "%a" SSCfg.pp converted
|