about summary refs log tree commit diff stats
path: root/example/expression/basic_op.py
diff options
context:
space:
mode:
authorFabrice Desclaux <fabrice.desclaux@cea.fr>2014-09-19 15:27:13 +0200
committerFabrice Desclaux <fabrice.desclaux@cea.fr>2014-09-19 15:27:13 +0200
commit308e7127ab1f67d62d02496aa73385533f8a3e7a (patch)
treead1b5eab8133ef9cc3d188e63f482ac680bcfa9a /example/expression/basic_op.py
parent032263e8f58573c5cbb61928b9edcc62855c989d (diff)
parent602f73846b316b7d6ba14f74355fb0da72571fb6 (diff)
downloadmiasm-308e7127ab1f67d62d02496aa73385533f8a3e7a.tar.gz
miasm-308e7127ab1f67d62d02496aa73385533f8a3e7a.zip
merge
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)]