New operator: modulo (written (%))!
This commit is contained in:
parent
d57196bb24
commit
412fd1f81b
|
@ -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)
|
||||||
|
|
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue