I have a set of equations in string format as given below. Need to assign some value to the left-hand side variable (In the below example: rsp, esp). Then have to calculate and store the results on the right-hand side variable (i.e., rax, esp, rsp).


rax = rsp

esp = esp - 0x4

rsp = rsp - 0x30

Though I have used the eval function in python, it is throwing me an error message as it won't support =. Could someone please help me to find the answer?

  • 1
    The answers to this question are not quick and easy. Time to read up on abstract syntax trees, parsers, and interpreters. I have a reading list on my website: msreverseengineering.com/program-analysis-reading-list You can expect to spend at least weeks studying these subjects before you feel comfortable doing what your question asks. Oct 13, 2022 at 9:34
  • @RolfRolles, thank you for your comment. I have found the solution to the question which I posted. With the help of "locals" and "globals" in python programming, this can be solved Oct 14, 2022 at 6:20

1 Answer 1


With the help of "locals" and "globals" in python programming, this can be solved

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.