package bap-std

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

expression visitor.

A class for observing expression trees.

Visits AST providing lots of hooks.

For each AST constructor C the visitor provides three methods: enter_C, visit_C, leave_C. The default implementation for enter_C and leave_C is to return its argument. The default implementation for visit_C is the following: 1. call enter_C 2. visit all children 3. call leave_C.

It is recommended to override enter_C method if you only need to visit C constructor without changing a way you're visiting the tree.

See also Bil.visitor and Term.visitor for visiting a program in AST and Graph representation, respectively.

inherit state
method enter_exp : t -> 'a -> 'a
method visit_exp : t -> 'a -> 'a
method leave_exp : t -> 'a -> 'a
method enter_load : mem:t -> addr:t -> endian -> size -> 'a -> 'a

Load (src,addr,endian,size)

method visit_load : mem:t -> addr:t -> endian -> size -> 'a -> 'a
method leave_load : mem:t -> addr:t -> endian -> size -> 'a -> 'a
method enter_store : mem:t -> addr:t -> exp:t -> endian -> size -> 'a -> 'a

Store (dst,addr,src,endian,size)

method visit_store : mem:t -> addr:t -> exp:t -> endian -> size -> 'a -> 'a
method leave_store : mem:t -> addr:t -> exp:t -> endian -> size -> 'a -> 'a
method enter_binop : binop -> t -> t -> 'a -> 'a

BinOp (op,e1,e2)

method visit_binop : binop -> t -> t -> 'a -> 'a
method leave_binop : binop -> t -> t -> 'a -> 'a
method enter_unop : unop -> t -> 'a -> 'a

Unop (op,e)

method visit_unop : unop -> t -> 'a -> 'a
method leave_unop : unop -> t -> 'a -> 'a
method enter_cast : cast -> int -> t -> 'a -> 'a

Cast(kind,size,e)

method visit_cast : cast -> int -> t -> 'a -> 'a
method leave_cast : cast -> int -> t -> 'a -> 'a
method enter_let : var -> exp:t -> body:t -> 'a -> 'a

Let (v,t,body)

method visit_let : var -> exp:t -> body:t -> 'a -> 'a
method leave_let : var -> exp:t -> body:t -> 'a -> 'a
method enter_ite : cond:t -> yes:t -> no:t -> 'a -> 'a

Ite (cond,yes,no)

method visit_ite : cond:t -> yes:t -> no:t -> 'a -> 'a
method leave_ite : cond:t -> yes:t -> no:t -> 'a -> 'a
method enter_extract : hi:int -> lo:int -> t -> 'a -> 'a

Extract (hi,lo,e)

method visit_extract : hi:int -> lo:int -> t -> 'a -> 'a
method leave_extract : hi:int -> lo:int -> t -> 'a -> 'a
method enter_concat : t -> t -> 'a -> 'a

Concat(e1,e2)

method visit_concat : t -> t -> 'a -> 'a
method leave_concat : t -> t -> 'a -> 'a
method enter_int : word -> 'a -> 'a

Int w

method visit_int : word -> 'a -> 'a
method leave_int : word -> 'a -> 'a
method enter_var : var -> 'a -> 'a

Var v

method visit_var : var -> 'a -> 'a
method leave_var : var -> 'a -> 'a
method enter_unknown : string -> typ -> 'a -> 'a

Unknown (str,typ)

method visit_unknown : string -> typ -> 'a -> 'a
method leave_unknown : string -> typ -> 'a -> 'a