diff --git a/compiler/main/mls2obc.ml b/compiler/main/mls2obc.ml index 0055595..4cbd9c7 100644 --- a/compiler/main/mls2obc.ml +++ b/compiler/main/mls2obc.ml @@ -46,7 +46,7 @@ let rec bound_check_expr idx_list bounds = match (idx_list, bounds) with | [idx], [n] -> mk_exp (Eop (op_from_string "<", - [ idx; mk_exp (Econst n)])) + [idx; mk_exp (Econst n)])) | (idx :: idx_list, n :: bounds) -> let e = mk_exp (Eop (op_from_string "<", [idx; mk_exp (Econst n)])) in diff --git a/compiler/obc/c/cgen.ml b/compiler/obc/c/cgen.ml index 067e153..cdae0d9 100644 --- a/compiler/obc/c/cgen.ml +++ b/compiler/obc/c/cgen.ml @@ -115,7 +115,7 @@ let copname = function | "-" -> "-" | "*" -> "*" | "/" -> "/" | "*." -> "*" | "/." -> "/" | "+." -> "+" | "-." -> "-" | "<" -> "<" | ">" -> ">" | "<=" -> "<=" | ">=" -> ">=" - | "~-" -> "-" | "not" -> "!" + | "~-" -> "-" | "not" -> "!" | "%" -> "%" | op -> op (** Translates an Obc var_dec to a tuple (name, cty). *) @@ -201,7 +201,7 @@ let rec create_affect_lit dest l ty = (** Creates the expression dest <- src (copying arrays if necessary). *) and create_affect_stm dest src ty = - match ty with + match ty with | Cty_arr (n, bty) -> (match src with | Carraylit l -> create_affect_lit dest l bty @@ -240,7 +240,7 @@ let rec cexpr_of_static_exp se = | Svar ln -> (try let cd = find_const ln in - cexpr_of_static_exp (Static.simplify QualEnv.empty cd.c_value) + cexpr_of_static_exp (Static.simplify QualEnv.empty cd.c_value) with Not_found -> assert false) | Sop _ -> let se' = Static.simplify QualEnv.empty se in @@ -283,7 +283,7 @@ and cop_of_op_aux op_name cexps = match op_name with "=" | "<>" | "&" | "or" | "+" | "-" | "*" | "/" - | "*." | "/." | "+." | "-." + | "*." | "/." | "+." | "-." | "%" | "<" | ">" | "<=" | ">="), [el;er] -> Cbop (copname op, el, er) | _ -> Cfun_call(op, cexps) diff --git a/lib/pervasives.epi b/lib/pervasives.epi index 86fabf3..2e76e49 100644 --- a/lib/pervasives.epi +++ b/lib/pervasives.epi @@ -7,6 +7,7 @@ type float val fun (&)(bool;bool) returns (bool) val fun ( * )(int;int) returns (int) val fun ( *. )(float;float) returns (float) +val fun (%)(int;int) returns (int) val fun (+)(int;int) returns (int) val fun (+.)(float;float) returns (float) val fun (-)(int;int) returns (int)