diff options
author | Son Ho | 2021-11-18 14:16:03 +0100 |
---|---|---|
committer | Son Ho | 2021-11-18 14:16:03 +0100 |
commit | b3db791672defe762ad6cc3e0bf3fa6cfbc7656b (patch) | |
tree | 2dc997477b7658dc73646bb7fb22eb9805cbec3e /src/main.ml | |
parent | efe4a28251a18ba713a90896be5d7dce655cae6b (diff) |
Make the json deserializer work
Diffstat (limited to 'src/main.ml')
-rw-r--r-- | src/main.ml | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/main.ml b/src/main.ml index 7f130949..d32d9d42 100644 --- a/src/main.ml +++ b/src/main.ml @@ -17,8 +17,22 @@ type rust_module = { [@@deriving of_yojson] let () = - (* let json = Yojson.Basic.from_file "../charon/charon/tests/test1.cfim" in *) - let _json1 = Yojson.Safe.from_file "../charon/charon/tests/test1.cfim" in + (* let json = Yojson.Basic.from_string "{\"Return\"}" in + print_endline (Yojson.Basic.show json)*) + let json = Yojson.Basic.from_file "../charon/charon/tests/test1.cfim" in + match cfim_module_of_json json with + | Error s -> Printf.printf "error: %s\n" s + | Ok _ast -> print_endline "Ok" +(* let json = Yojson.Basic.from_string "{\"Statement\":\"Return\"}" in + print_endline (Yojson.Basic.show json)*) + +(* let json = Yojson.Safe.from_file "../charon/charon/tests/test1.cfim" in + match cfim_module_of_json json with + | Error s -> Printf.printf "error: %s\n" s + | Ok _ast -> print_endline "Ok"*) + +(* let json = Yojson.Basic.from_file "../charon/charon/tests/test1.cfim" in *) +(* let _json1 = Yojson.Safe.from_file "../charon/charon/tests/test1.cfim" in let st1 = Return in let json1 = statement_to_yojson st1 in print_endline (Yojson.Safe.to_string json1); @@ -31,7 +45,7 @@ let () = let json2 = Yojson.Safe.from_string "[\"Return\"]" in match statement_of_yojson json2 with | Error s -> Printf.printf "error: %s\n" s - | Ok _ast -> print_endline "ast" + | Ok _ast -> print_endline "ast"*) (* match rust_module_of_yojson json with | Error s -> Printf.printf "error: %s\n" s | Ok _ast -> print_endline "ast"*) |