about summary refs log tree commit diff stats
path: root/example/expression/manip_expression1.py
diff options
context:
space:
mode:
authorserpilliere <devnull@localhost>2012-02-27 10:46:29 +0100
committerserpilliere <devnull@localhost>2012-02-27 10:46:29 +0100
commitc12642d1d0ab242054a95db52d79f8e208f02355 (patch)
tree3a91aea9c79bc85b086882e8fd97c804749c25db /example/expression/manip_expression1.py
parent9ada5b417a2b92aa855791fb2d4c3e282c2dcb2e (diff)
downloadmiasm-c12642d1d0ab242054a95db52d79f8e208f02355.tar.gz
miasm-c12642d1d0ab242054a95db52d79f8e208f02355.zip
example: add expression manipulation demo
Diffstat (limited to 'example/expression/manip_expression1.py')
-rw-r--r--example/expression/manip_expression1.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/example/expression/manip_expression1.py b/example/expression/manip_expression1.py
new file mode 100644
index 00000000..7c6c8965
--- /dev/null
+++ b/example/expression/manip_expression1.py
@@ -0,0 +1,28 @@
+from miasm.expression.expression import *
+
+print 'simple expression manipulation demo'
+# define 2 ID
+a = ExprId('eax', 32)
+b = ExprId('ebx', 32)
+print a, b
+# eax ebx
+
+# add those ID
+c = ExprOp('+', a, b)
+print c
+# (eax + ebx)
+
+# + automaticaly generates ExprOp('+', a, b)
+c = a + b
+print c
+# (eax + ebx)
+
+# ax is a slice of eax
+ax = a[:16]
+print ax
+# eax[0:16]
+
+#memory deref
+d = ExprMem(c, 32)
+print d
+# @32[(eax + ebx)]