diff --git a/compiler/global/static.ml b/compiler/global/static.ml index 1560142..f9f3ffa 100644 --- a/compiler/global/static.ml +++ b/compiler/global/static.ml @@ -101,6 +101,7 @@ let apply_op partial loc op se_list = | "~~", [Sint n] -> Sint (lnot n) | "~-.", [Sfloat f] -> Sfloat (-. f) | "&&&", [Sint n1; Sint n2] -> Sint (n1 land n2) + | "|||", [Sint n1; Sint n2] -> Sint (n1 lor n2) | f,_ -> Misc.internal_error ("Static evaluation failed of the pervasive operator "^f) ) else ( (* symbolic evaluation *) diff --git a/compiler/obc/c/cgen.ml b/compiler/obc/c/cgen.ml index 46c1f6f..42993a3 100644 --- a/compiler/obc/c/cgen.ml +++ b/compiler/obc/c/cgen.ml @@ -109,7 +109,7 @@ let copname = function | "+." -> "+" | "-." -> "-" | "<" -> "<" | ">" -> ">" | "<=" -> "<=" | ">=" -> ">=" | "<=." -> "<=" | "<." -> "<" | ">=." -> ">=" | ">." -> ">" | "~-" -> "-" | "not" -> "!" | "%" -> "%" - | ">>>" -> ">>" | "<<<" -> "<<" | "&&&" -> "&" + | ">>>" -> ">>" | "<<<" -> "<<" | "&&&" -> "&" | "|||" -> "|" | op -> op (** Translates an Obc var_dec to a tuple (name, cty). *) @@ -274,7 +274,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/compiler/obc/java/java_printer.ml b/compiler/obc/java/java_printer.ml index ca10fb4..050ca83 100644 --- a/compiler/obc/java/java_printer.ml +++ b/compiler/obc/java/java_printer.ml @@ -117,6 +117,7 @@ and op ff (f, e_l) = | "<<<" -> "<<" | ">>>" -> ">>" | "&&&" -> "&" + | "|||" -> "|" | op -> op in match Names.modul f with diff --git a/lib/pervasives.epi b/lib/pervasives.epi index 8b48063..5c79c50 100644 --- a/lib/pervasives.epi +++ b/lib/pervasives.epi @@ -31,6 +31,7 @@ val fun (~~)(int) returns (int) val fun (>>>)(int;int) returns (int) val fun (<<<)(int;int) returns (int) val fun (&&&)(int;int) returns (int) +val fun (|||)(int;int) returns (int) val fun (~-.)(float) returns (float) val fun do_stuff(int) returns (int) val fun between(int;int) returns (int)