Skip to content

Commit

Permalink
slightly repairing rustic (still broken)
Browse files Browse the repository at this point in the history
  • Loading branch information
kmemarian committed Jul 7, 2023
1 parent f2f2951 commit 6676197
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
3 changes: 1 addition & 2 deletions backend/rustic/dune
Original file line number Diff line number Diff line change
Expand Up @@ -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))
2 changes: 1 addition & 1 deletion backend/rustic/src/rustic_parser.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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 >>
Expand Down
2 changes: 1 addition & 1 deletion backend/rustic/src/rustic_types.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 8 additions & 2 deletions backend/rustic/src/typechecker.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand All @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit 6676197

Please sign in to comment.