Project

General

Profile

Revision 30dee850

View differences:

src/backends/EMF/EMF_backend.ml
26 26
    | Expr_access (a, d) -> fprintf fmt "%a[%a]" pp_expr a Dimension.pp_dimension d
27 27
    | Expr_power (a, d) -> fprintf fmt "(%a^%a)" pp_expr a Dimension.pp_dimension d
28 28
    | Expr_tuple el -> fprintf fmt "(%a)" pp_tuple el
29
    | Expr_ite (c, t, e) -> fprintf fmt "if %a; %a; else %a; end" pp_expr c pp_expr t pp_expr e
29
    | Expr_ite (c, t, e) -> fprintf fmt "if %a; y=(%a); else y=(%a); end" pp_expr c pp_expr t pp_expr e
30 30
    | Expr_arrow (e1, e2) ->(
31 31
      match e1.expr_desc, e2.expr_desc with
32 32
      | Expr_const c1, Expr_const c2 -> if c1 = Corelang.const_of_bool true && c2 = Corelang.const_of_bool false then fprintf fmt "STEP" else assert false (* only handle true -> false *)
33 33
      | _ -> assert false (* only handle true -> false *)
34 34
    )
35 35
    | Expr_fby (e1, e2) -> assert false (* not covered yet *)
36
    | Expr_pre e -> fprintf fmt "UNITDELAY" 
36
    | Expr_pre e -> fprintf fmt "UNITDELAY"
37 37
    | Expr_when (e, id, l) -> assert false (* clocked based expressions are not handled yet *)
38 38
    | Expr_merge (id, hl) -> assert false (* clocked based expressions are not handled yet *)
39 39
    | Expr_appl (id, e, r) -> pp_app fmt id e r
......
62 62
    | "<=", Expr_tuple([e1;e2]) -> fprintf fmt "(%a <= %a)" pp_expr e1 pp_expr e2
63 63
    | ">", Expr_tuple([e1;e2]) -> fprintf fmt "(%a > %a)" pp_expr e1 pp_expr e2
64 64
    | ">=", Expr_tuple([e1;e2]) -> fprintf fmt "(%a >= %a)" pp_expr e1 pp_expr e2
65
    | "!=", Expr_tuple([e1;e2]) -> fprintf fmt "(%a != %a)" pp_expr e1 pp_expr e2
66
    | "=", Expr_tuple([e1;e2]) -> fprintf fmt "(%a = %a)" pp_expr e1 pp_expr e2
65
    | "!=", Expr_tuple([e1;e2]) -> fprintf fmt "(%a ~= %a)" pp_expr e1 pp_expr e2
66
    | "=", Expr_tuple([e1;e2]) -> fprintf fmt "(%a == %a)" pp_expr e1 pp_expr e2
67 67
    | "not", _ -> fprintf fmt "(~%a)" pp_expr e
68 68
    | _, Expr_tuple _ -> fprintf fmt "%s %a" id pp_expr e
69 69
    | _ -> fprintf fmt "%s (%a)" id pp_expr e
......
86 86
    | Expr_fby (e1, e2) -> fprintf fmt "%a fby %a" pp_expr e1 pp_expr e2
87 87
    | Expr_pre e -> fprintf fmt "pre %a" pp_expr e
88 88
    | Expr_when (e, id, l) -> fprintf fmt "%a when %s(%s)" pp_expr e l id
89
    | Expr_merge (id, hl) -> 
89
    | Expr_merge (id, hl) ->
90 90
      fprintf fmt "merge %s %a" id pp_handlers hl
91 91
    | Expr_appl (id, e, r) -> pp_app fmt id e r
92 92
*)
93
    
93

  
94 94
let pp_stmt fmt stmt =
95 95
  match stmt with
96 96
  | Eq eq -> (
......
98 98
      [var] -> (
99 99
     (* first, we extract the expression and associated variables *)
100 100
	let vars = Utils.ISet.elements (Corelang.get_expr_vars eq.eq_rhs) in
101
	
101

  
102 102
	fprintf fmt "\"%s\": @[<v 2>{ \"expr\": \"%a\",@ \"vars\": [%a] @]}"
103 103
	  var
104 104
	  (pp_expr vars) eq.eq_rhs (* todo_pp_expr expr *)
......
116 116
  fprintf fmt "\"exprs\": {@[<v 1> %a@]@ }"
117 117
    (fprintf_list ~sep:",@ " pp_stmt ) nd.node_stmts;
118 118
  fprintf fmt "@]@ }"
119
    
119

  
120 120
let pp_decl fmt decl =
121 121
  match decl.top_decl_desc with
122 122
  | Node nd -> fprintf fmt "%a@ " pp_node nd
123
  | ImportedNode _ 
123
  | ImportedNode _
124 124
  | Const _
125
  | Open _ 
125
  | Open _
126 126
  | TypeDef _ -> eprintf "should not happen in EMF backend"
127 127

  
128 128

  
......
130 130
  fprintf fmt "@[<v 0>{@ ";
131 131
  fprintf_list ~sep:",@ " pp_decl fmt prog;
132 132
  fprintf fmt "@ @]}"
133

  

Also available in: Unified diff