about summary refs log tree commit diff stats
path: root/example/expression/manip_expression3.py
diff options
context:
space:
mode:
Diffstat (limited to 'example/expression/manip_expression3.py')
-rw-r--r--example/expression/manip_expression3.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/example/expression/manip_expression3.py b/example/expression/manip_expression3.py
new file mode 100644
index 00000000..06b3f77a
--- /dev/null
+++ b/example/expression/manip_expression3.py
@@ -0,0 +1,20 @@
+from miasm.arch.ia32_sem import *
+from miasm.expression.expression_helper import *
+
+print 'simple expression simplification demo'
+print
+
+a = ExprId('eax')
+b = ExprId('ebx')
+c = a + b
+d = c - a
+print d
+# ((eax + ebx) - eax)
+print "=>", expr_simp(d)
+print
+# ebx
+e = ExprInt(uint32(0x12)) + ExprInt(uint32(0x30)) - a
+print e
+# ((0x12 + 0x30) - eax)
+print "=>",  expr_simp(e)
+# (0x42 - eax)