summaryrefslogtreecommitdiff
path: root/src/ast_util.mli
diff options
context:
space:
mode:
authorAlasdair Armstrong2017-08-23 17:57:26 +0100
committerAlasdair Armstrong2017-08-23 17:57:26 +0100
commitb9810423d4eece710a276384a4664aaab6aed046 (patch)
treee5de0df1abbf25ed0cb59c5807fa73ff0723a442 /src/ast_util.mli
parentc380d2d0b51be71871085ac7d085268f5baccb56 (diff)
Started work on an undefined literal removal pass for the ocaml
backed. Ocaml doesn't support undefined values, so we need a way to remove them from the specification in order to generate good ocaml code. There are more subtle issues to - like if we initialize a mutable variable with an undefined list, then the ocaml runtime has no way of telling what it's length should be (as this information is removed by the simple_types pass). We therefore rewrite undefined literals with calls to functions that create undefined types, e.g. (bool) undefined becomes undefined_bool () (vector<'n,'m,dec,bit>) undefined becomes undefined_vector(sizeof 'n, sizeof 'm, undefined_bit ()) We therefore have to generate undefined_X functions for any user defined datatype X. initial_check seems to be the logical place for this. This is straightforward provided the user defined types are not-recursive (and it shouldn't be too bad even if they are).
Diffstat (limited to 'src/ast_util.mli')
-rw-r--r--src/ast_util.mli10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/ast_util.mli b/src/ast_util.mli
index b0ccb7b8..7580404d 100644
--- a/src/ast_util.mli
+++ b/src/ast_util.mli
@@ -47,10 +47,18 @@ open Ast
val mk_nc : n_constraint_aux -> n_constraint
val mk_nexp : nexp_aux -> nexp
val mk_exp : unit exp_aux -> unit exp
+val mk_pat : unit pat_aux -> unit pat
val mk_lit : lit_aux -> lit
+val mk_lit_exp : lit_aux -> unit exp
+val mk_funcl : id -> unit pat -> unit exp -> unit funcl
+val mk_fundef : (unit funcl) list -> unit def
+val mk_val_spec : val_spec_aux -> unit def
val unaux_exp : 'a exp -> 'a exp_aux
+val inc_ord : order
+val dec_ord : order
+
(* Functions to map over the annotations in sub-expressions *)
val map_exp_annot : ('a annot -> 'b annot) -> 'a exp -> 'b exp
val map_pat_annot : ('a annot -> 'b annot) -> 'a pat -> 'b pat
@@ -92,6 +100,8 @@ val id_of_fundef : 'a fundef -> id
val id_of_kid : kid -> id
+val prepend_id : string -> id -> id
+
module Id : sig
type t = id
val compare : id -> id -> int