From 67f1659c7a1fb88066eba28bdaee12510d8e0480 Mon Sep 17 00:00:00 2001 From: elvis Date: Wed, 20 Nov 2024 00:13:05 +0100 Subject: [PATCH] Main has test for cfg --- bin/main.ml | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/bin/main.ml b/bin/main.ml index c6a0569..9d63d55 100644 --- a/bin/main.ml +++ b/bin/main.ml @@ -1 +1,20 @@ -print_endline "Hello!" +open MiniImp +open MiniImp.Cfg + +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" Cfg.pp converted