diff options
| author | Alasdair Armstrong | 2017-08-23 17:57:26 +0100 |
|---|---|---|
| committer | Alasdair Armstrong | 2017-08-23 17:57:26 +0100 |
| commit | b9810423d4eece710a276384a4664aaab6aed046 (patch) | |
| tree | e5de0df1abbf25ed0cb59c5807fa73ff0723a442 /src/pretty_print_sail.ml | |
| parent | c380d2d0b51be71871085ac7d085268f5baccb56 (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/pretty_print_sail.ml')
| -rw-r--r-- | src/pretty_print_sail.ml | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/pretty_print_sail.ml b/src/pretty_print_sail.ml index b0b63ec1..2f38fe02 100644 --- a/src/pretty_print_sail.ml +++ b/src/pretty_print_sail.ml @@ -345,6 +345,8 @@ let doc_exp, doc_let = | E_internal_exp_user _ -> raise (Reporting_basic.err_unreachable Unknown ("internal_exp_user not rewritten away")) | E_internal_cast ((_, Overload (_, _,_ )), _) | E_internal_exp _ -> assert false *) + | E_internal_let (lexp, exp1, exp2) -> + separate space [string "internal let"; doc_lexp lexp; equals; exp exp1; string "in"; exp exp2] | _ -> failwith ("Cannot print: " ^ Ast_util.string_of_exp expr) and let_exp (LB_aux(lb,_)) = match lb with | LB_val_explicit(ts,pat,e) -> |
