summaryrefslogtreecommitdiff
path: root/src/main.ml
blob: fc9e4efd01ae273681bbecd026f229690ee895d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
open Types
open CfimAst

type declaration =
  | Type of TypeDefId.id
  | Fun of FunDefId.id
  | RecTypes of TypeDefId.id list
  | RecFuns of FunDefId.id list
[@@deriving of_yojson]

type rust_module = {
  declarations : declaration list;
  types : type_def TypeDefId.vector;
  functions : fun_def FunDefId.vector;
}
[@@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 json2 = Yojson.Safe.from_file "../charon/charon/tests/test4.cfim" in
  match statement_of_yojson json2 with
  | Error s -> Printf.printf "error: %s\n" s
  | 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"*)