kdrag.utils.ast_size_sexpr
- kdrag.utils.ast_size_sexpr(t: AstRef) int
Get an approximate size of an AST node by its s-expression length. This is probably faster than any python layer traversal one can do. Pretty printed ast size will be correlated to expression size, maybe even DAG size, since Z3 inserts `let`s to avoid duplication.
>>> ast_size_sexpr(smt.Int("x")) 1 >>> ast_size_sexpr(smt.Int("x") + smt.Int("y")) 7
- Parameters:
t (AstRef)
- Return type:
int