New operator: modulo (written (%))!

This commit is contained in:
Adrien Guatto 2010-10-02 12:59:44 +02:00
parent d57196bb24
commit 412fd1f81b
3 changed files with 6 additions and 5 deletions

View file

@ -115,7 +115,7 @@ let copname = function
| "-" -> "-" | "*" -> "*" | "/" -> "/" | "*." -> "*" | "/." -> "/" | "-" -> "-" | "*" -> "*" | "/" -> "/" | "*." -> "*" | "/." -> "/"
| "+." -> "+" | "-." -> "-" | "<" -> "<" | ">" -> ">" | "<=" -> "<=" | "+." -> "+" | "-." -> "-" | "<" -> "<" | ">" -> ">" | "<=" -> "<="
| ">=" -> ">=" | ">=" -> ">="
| "~-" -> "-" | "not" -> "!" | "~-" -> "-" | "not" -> "!" | "%" -> "%"
| op -> op | op -> op
(** Translates an Obc var_dec to a tuple (name, cty). *) (** Translates an Obc var_dec to a tuple (name, cty). *)
@ -283,7 +283,7 @@ and cop_of_op_aux op_name cexps = match op_name with
"=" | "<>" "=" | "<>"
| "&" | "or" | "&" | "or"
| "+" | "-" | "*" | "/" | "+" | "-" | "*" | "/"
| "*." | "/." | "+." | "-." | "*." | "/." | "+." | "-." | "%"
| "<" | ">" | "<=" | ">="), [el;er] -> | "<" | ">" | "<=" | ">="), [el;er] ->
Cbop (copname op, el, er) Cbop (copname op, el, er)
| _ -> Cfun_call(op, cexps) | _ -> Cfun_call(op, cexps)

View file

@ -7,6 +7,7 @@ type float
val fun (&)(bool;bool) returns (bool) val fun (&)(bool;bool) returns (bool)
val fun ( * )(int;int) returns (int) val fun ( * )(int;int) returns (int)
val fun ( *. )(float;float) returns (float) val fun ( *. )(float;float) returns (float)
val fun (%)(int;int) returns (int)
val fun (+)(int;int) returns (int) val fun (+)(int;int) returns (int)
val fun (+.)(float;float) returns (float) val fun (+.)(float;float) returns (float)
val fun (-)(int;int) returns (int) val fun (-)(int;int) returns (int)