You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are some slight differences between smtlib and sexplib and different notions of allowed identifiers in bap, smtlib, and sexplib that have continually made things awkward. In addition, there is in principle a possibility of name clashing of high level variables and low level variables.
The canonical example (perhaps only really) that causes this issue is the bap generated identifier like #80. A # character in smtlib identifiers must be quoted using |#80| syntax. Z3 is not entirely consistent to my understanding of how it treats the | quotes, so we sometimes have to strip them
let var_name =String.strip ~drop:(func -> Char.(c ='|')) (Expr.to_string z3_var) in
This however clashes with sexplib, which uses |# and #| to denote block comments. To abandon or replicate sexplib merely for this feels insane. That led to this embarassing hack
namespace all variables with disjoint prefixes cbatvar_, highlevelvar_, realreg etc as need be. The names will still be | quoted in the presence of #, but sexplib will work. let name = "cbat_" ^ name in would basically do it
Replace # with a friendlier character here. Anything else. The smtlib allows for " a non-empty sequence of letters, digits and the characters + - / * = % ? ! . $ _ ˜ & ˆ < > @ that does not start with a digit"
Leave as is. The new feature will use sprintf injection of smtlib library functions and not use Sexp.t
Ask bap very nicely to use a different character for it's internally generated names. This is of course not really under our control and would probably break all sorts of stuff across the bap ecosystem. So not a very good solution.
As a possible increase of scope of this ticket, perhaps we also want a better way to namespace the init__orig, _mod versions of variables.
The text was updated successfully, but these errors were encountered:
There are some slight differences between smtlib and sexplib and different notions of allowed identifiers in bap, smtlib, and sexplib that have continually made things awkward. In addition, there is in principle a possibility of name clashing of high level variables and low level variables.
The canonical example (perhaps only really) that causes this issue is the bap generated identifier like
#80
. A#
character in smtlib identifiers must be quoted using|#80|
syntax. Z3 is not entirely consistent to my understanding of how it treats the|
quotes, so we sometimes have to strip themcbat_tools/wp/lib/bap_wp/src/z3_utils.ml
Line 35 in 176753a
This however clashes with sexplib, which uses
|#
and#|
to denote block comments. To abandon or replicate sexplib merely for this feels insane. That led to this embarassing hackcbat_tools/wp/lib/bap_wp/src/z3_utils.ml
Line 263 in 176753a
Here are possible suggestions both of which can be done at
cbat_tools/wp/lib/bap_wp/src/environment.ml
Line 111 in 176753a
cbatvar_
,highlevelvar_
,realreg
etc as need be. The names will still be|
quoted in the presence of#
, but sexplib will work.let name = "cbat_" ^ name in
would basically do it#
with a friendlier character here. Anything else. The smtlib allows for " a non-empty sequence of letters, digits and the characters + - / * = % ? ! . $ _ ˜ & ˆ < > @ that does not start with a digit"sprintf
injection of smtlib library functions and not use Sexp.tAs a possible increase of scope of this ticket, perhaps we also want a better way to namespace the
init_
_orig
,_mod
versions of variables.The text was updated successfully, but these errors were encountered: