From 66761974a6d38e8f9908bb43c137f6cd5c4906d7 Mon Sep 17 00:00:00 2001 From: Kayvan Memarian Date: Fri, 7 Jul 2023 17:35:00 +0100 Subject: [PATCH] slightly repairing rustic (still broken) --- backend/rustic/dune | 3 +-- backend/rustic/src/rustic_parser.ml | 2 +- backend/rustic/src/rustic_types.ml | 2 +- backend/rustic/src/typechecker.ml | 10 ++++++++-- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/backend/rustic/dune b/backend/rustic/dune index af01d38d7..1c67cb37e 100644 --- a/backend/rustic/dune +++ b/backend/rustic/dune @@ -5,5 +5,4 @@ (public_name rustic) (package rustic) (flags (:standard -w -27)) - (libraries cmdliner str unix - cerb_frontend cerb_backend mem_concrete util)) + (libraries cmdliner camlp-streams str unix mem_concrete cerberus-lib.backend_common)) diff --git a/backend/rustic/src/rustic_parser.ml b/backend/rustic/src/rustic_parser.ml index 13d3df437..3113d7bca 100644 --- a/backend/rustic/src/rustic_parser.ml +++ b/backend/rustic/src/rustic_parser.ml @@ -23,7 +23,7 @@ let scoping = (var >>= fun s -> return (RCS_scoped s)) let make_sym s = - Symbol.Symbol (Cerb_fresh.digest (), 0, Some s) (* TODO: is this the right thing? *) + Symbol.Symbol (Cerb_fresh.digest (), 0, Symbol.SD_Id s) (* TODO: is this the right thing? *) let rec ty s = (spaces >> diff --git a/backend/rustic/src/rustic_types.ml b/backend/rustic/src/rustic_types.ml index 9e3a54095..ea73d2345 100644 --- a/backend/rustic/src/rustic_types.ml +++ b/backend/rustic/src/rustic_types.ml @@ -85,7 +85,7 @@ type rc_change = (* TODO: this is super brittle, but I don't know how else to do it *) let string_of_sym (Symbol.Symbol (_, _, id_opt)) = - match id_opt with Some id -> id | None -> assert false (* FIXME? *) + match id_opt with Symbol.SD_Id id -> id | _ -> assert false (* FIXME? *) let string_of_scoping = function | RCS_scoped s -> s diff --git a/backend/rustic/src/typechecker.ml b/backend/rustic/src/typechecker.ml index b84908422..080b9ab3c 100644 --- a/backend/rustic/src/typechecker.ml +++ b/backend/rustic/src/typechecker.ml @@ -35,7 +35,7 @@ let plop2 = function | _ :: _ as l -> "(" ^ String.concat ", " l ^ ")" let string_of_attr attr = - let attr_args = List.map snd attr.Annot.attr_args in + let attr_args = List.map (fun (_, z, _) -> z) attr.Annot.attr_args in string_of_identifier attr.Annot.attr_id ^ plop2 attr_args let string_of_attrs attrs = @@ -54,9 +54,14 @@ let string_of_annots annots = | Astd x -> None | Aloc loc -> None | Auid _ -> None + | Amarker _ -> None + | Amarker_object_types _ -> None | Abmc _ -> None | Aattrs (Attrs attrs) -> Some attrs - | Atypedef _ -> failwith "?") + | Atypedef _ -> failwith "?" + | Anot_explode -> None + | Alabel _ -> None + | Acerb _ -> None) annots in let annots = List.concat annots in String.concat " " (List.map string_of_attr annots) @@ -69,6 +74,7 @@ and string_of_ctype_ = function | Basic x -> "int" (* TODO: lies *) | Array (cty, sz) -> "array(" ^ string_of_ctype cty ^ ")" | Function _ -> "function" +| FunctionNoParams _ -> "function_no_params" | Pointer (qls, cty) -> string_of_ctype cty ^ "*" | Atomic cty -> "atomic(" ^ string_of_ctype cty ^ ")" | Struct name -> string_of_sym name