Ast.Expr
Syntax tree for program expressions (both IMP and SSA ones).
The main expression type is the unary expr
, which is hashconsed version of expr_node
. expr_node
is private to avoid breaking hash-consing: it can be inspected, but must be built using the constructors in provided by the Make
functor.
type binop = Frama_c_kernel.Cil_types.binop =
| PlusA
arithmetic +
*)| PlusPI
pointer + integer, unsupported
*)| MinusA
arithmetic -
*)| MinusPI
pointer - integer, unsupported
*)| MinusPP
pointer - pointer, unsupported
*)| Mult
*
*)| Div
/
*)| Mod
%
*)| Shiftlt
shift left
*)| Shiftrt
shift right
*)| Lt
< (arithmetic comparison)
*)| Gt
> (arithmetic comparison)
*)| Le
<= (arithmetic comparison)
*)| Ge
>= (arithmetic comparison)
*)| Eq
== (arithmetic comparison)
*)| Ne
!= (arithmetic comparison)
*)| BAnd
bitwise and
*)| BXor
exclusive-or
*)| BOr
inclusive-or
*)| LAnd
logical and.
*)| LOr
logical or.
*)Binary operators
Expressions are parametrized by the type of variable so we can reuse them for SSA. They are also hashconsed, hence the private type Use the Make(Var)
functor's smart constructors to build expressions
and 'var expr = 'var expr_node Hashconsing.hash_consed
module type S = sig ... end
module Binop : Std_extra.Types.TYPE with type t = binop
module Unop : Std_extra.Types.TYPE with type t = unop
The first argument of bind
and map
is of_node
to turn an element into it's hashconsed version
val is_const : 'a expr -> bool
true
if the expression contains no variables
val size : 'a expr -> int
Expression size (number of nodes)
val depth : 'a expr -> int
Expression depth
val is_constant : 'a expr -> Z.t option