Slide 16
Slide 16 text
Symbolic Backward Execution (by @K_atc)
1. Python ast AST
2. AST GCL
❷ Python →Python AST→GCL
import ast
code = "if (x > 0): y = 1"
p = ast.parse(code)
S = seq_node(p.body)
if isinstance(node, ast.Assign):
target = expr_node(node.targets[0], depth + 1, function_name)
value = expr_node(node.value, depth + 1, function_name)
assign_returned_values = __assign_returned_values(node.value)
return assign_returned_values + gcl.Substitute(target, value)
Assign →GCL
GCL
If(x > 0, Substitute(y, 1), Skip())
S
Module(body=[If(test=Compare(left=Name(id=‘x’, ctx=Load()), ops=[Gt()],
comparators=[Num(n=0)]), body=[Assign(targets=[Name(id='y', ctx=Store())],
value=Num(n=1))], orelse=[])])
p
Python AST GCL