package bap-std
- Overview
- No Docs
You can search for identifiers within the package.
in-package search v0.2.0
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=631fc58628418e4856709a0cfc923a65e00c9494fbd28d444c633d11194831de
md5=3db9deac8d429b9b8a8ec9aec54987b1
doc/bap/Bap/Std/Bil/Trie/index.html
Module Bil.Trie
Tries on BIL.
Bil provides two prefix tries trees.
The default one is not normalized and will compare bil statements literally. This means that comparison is sensitive to variable names and immediate values. Depending on your context it may be find or not. For example, two SP variables may compare as different if one of them was obtained from different compilation (and met the other one through some persistent storage, e.g., file on hard disk). Moreover, BIL obtained from different lifters will have different names for the same registers. All this issues are addressed in normalized Trie.
val normalize : ?subst:(exp * exp) list -> stmt list -> normalized_bilnormalize ?subst bil normalize BIL. If subst is provided, then substitute each occurrence of the fst expression to the snd expression before the normalization. The effect of normalization is the following:
1. All immediate values are compared equal 2. All variables are compared nominally 3. BIL is simplified to reduce the syntactic differences (but the comparison is still syntactic, and (x + 2) will be compared differently to (2 + x).
module Normalized : Trie.S with type key = normalized_bilinclude Trie.S with type key = stmt list
include Core_kernel.Bin_prot.Binable.S1 with type 'a t := 'a t
val bin_size_t : ('a, 'a t) Bin_prot.Size.sizer1val bin_write_t : ('a, 'a t) Bin_prot.Write.writer1val bin_read_t : ('a, 'a t) Bin_prot.Read.reader1val __bin_read_t__ : ('a, int -> 'a t) Bin_prot.Read.reader1val bin_writer_t : ('a, 'a t) Bin_prot.Type_class.S1.writerval bin_reader_t : ('a, 'a t) Bin_prot.Type_class.S1.readerval bin_t : ('a, 'a t) Bin_prot.Type_class.S1.ttype key = stmt lista key type that is used to lookup data
val create : unit -> 'a tcreate () creates new empty trie
add trie ~key ~data associates data with key. If trie already has some value associated with key, then the value will be overwritten (rebound)
change trie key f if trie has data associated with key then f will be called with Some data, otherwise it will be called with None. If f returns None then there will be no data associated with key, if f returns Some thing, then thing will be associated with key
walk trie key ~init ~f walks down the tree starting from the root and ending with the last token of the key. Function f is fold over values associated with all substrings of the key, starting from a zero substring.
longest_match trie key find a value associated with a longest substring of key. Returns a pair - a length of matched key and the value, associated with that key.
val length : 'a t -> intlength trie returns the number of values in trie
val pp : (Format.formatter -> 'a -> unit) -> Format.formatter -> 'a t -> unitpp pp_val creates a printer for a given value printer pp_val. Example:
let int_trie = String.Trie.pp pp_int
will create a printer for a String.Trie that is populated by integers.