Evaluate Variables in QtScript

I think you are looking for how to solve an equation using JavaScript  something very different from evaluating script, such as the QtScript engine does.
The problem you pose has more than one solution as well, as you can see here: "Wolfram Alpha":http://www.wolframalpha.com/input/?i=c+=+a+++b+++15 (sorry you have to enter the equation again as this forum destroys it).
Some solutions for your equation would be
25 = 5 + 5 + 15
35 = 10 + 10 + 15and so on.

I do not have a real world example, but I try to explain it more global.
Let's assume I can get scriptcode in several ways (file, tcp, ...) and I want to execute this code in the script engine. Before executing the code I would like to get somehow a list of used variables.
The question is now, how to get the list of variables?