about summary refs log tree commit diff stats
path: root/example/expression/basic_op.py
diff options
context:
space:
mode:
authorCamille Mougey <camille.mougey@cea.fr>2014-09-19 13:58:03 +0200
committerCamille Mougey <camille.mougey@cea.fr>2014-09-19 13:58:03 +0200
commit2bc1d7810dd07f9a0401984125fc82ac5ac7d9aa (patch)
tree40e084cd2bb9e6224c1fdbfef158f71102863897 /example/expression/basic_op.py
parent69c35ab316c0dae069ad7fb9d0567c6dd8746a8e (diff)
downloadmiasm-2bc1d7810dd07f9a0401984125fc82ac5ac7d9aa.tar.gz
miasm-2bc1d7810dd07f9a0401984125fc82ac5ac7d9aa.zip
Expression examples: Rename examples with meaningfull names
Diffstat (limited to 'example/expression/basic_op.py')
-rw-r--r--example/expression/basic_op.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/example/expression/basic_op.py b/example/expression/basic_op.py
new file mode 100644
index 00000000..a9ed00e3
--- /dev/null
+++ b/example/expression/basic_op.py
@@ -0,0 +1,31 @@
+from miasm2.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)]