[ast2C] adding the (->) construct
This commit is contained in:
parent
791af71913
commit
243e8f245a
@ -118,7 +118,9 @@ let rec cp_value fmt (value, (hloc: (ident * bool, string * int) Hashtbl.t)) =
|
||||
| CVInput n -> n) in
|
||||
let (arr, idx) = Hashtbl.find hloc (varname, true) in
|
||||
Format.fprintf fmt "state->%s[%d]" arr idx
|
||||
| CBinOp (BOp_arrow, v, v') -> failwith "[cprint.ml] (->) TODO!"
|
||||
| CBinOp (BOp_arrow, v, v') ->
|
||||
Format.fprintf fmt "(state->is_init ? (%a) : (%a))"
|
||||
cp_value (v, hloc) cp_value (v', hloc)
|
||||
| CBinOp (op, v, v') ->
|
||||
Format.fprintf fmt "(%a) %s (%a)"
|
||||
cp_value (v, hloc) (string_of_binop op) cp_value (v', hloc)
|
||||
|
@ -41,10 +41,10 @@ let equation_to_expression ((hloc: (ident * bool, string * int)Hashtbl.t), ((vl,
|
||||
| IEBinOp (op, e, e') ->
|
||||
CAssign (fetch_unique_var (),
|
||||
CBinOp (op, iexpression_to_cvalue e, iexpression_to_cvalue e'))
|
||||
(*| IEComp (op, e, e') ->
|
||||
CComp (op, iexpression_to_cvalue e, iexpression_to_cvalue e')
|
||||
| IEConst c -> CConst c
|
||||
TODO!
|
||||
| IEComp (op, e, e') ->
|
||||
CAssign (fetch_unique_var (),
|
||||
CComp (op, iexpression_to_cvalue e, iexpression_to_cvalue e'))
|
||||
(*TODO!
|
||||
| IETriOp of triop * i_expression * i_expression * i_expression
|
||||
| IEWhen of i_expression * i_expression
|
||||
| IEReset of i_expression * i_expression
|
||||
|
@ -1,7 +1,7 @@
|
||||
node n (i: int) returns (o: int);
|
||||
var v, t: int; a, b: bool;
|
||||
let
|
||||
a = true;
|
||||
a = true -> false;
|
||||
b = a and not (pre a);
|
||||
o = 1;
|
||||
v = pre o;
|
||||
|
Loading…
Reference in New Issue
Block a user