I remember a piece of code I had on the AtariST, it was from a book called GFA Basic for Experts or something, anyway it had a really amazing maths parser, which had variables and everything. You could basically get it calculate any formula you threw at it. I reckon a similar approach would help you.
In your language, your variables will need a lot of flexibility, so I suggest storing all your variable names in an array, and storing the value as text in an array too. You need to be able to pass a variable name to a function and get it's value, it's about the only neat way to handle live variables like this.
At each line, you will have to replace each variable name with it's value, then you would do your maths passes. Most languages use brackets to seperate complex formulas, so you'd look for small calculations inside brackets, calculate then remove the brackets, basically replace each set of brackets with a value. Pass over the line until there are no more brackets then calculate each pair of values, so 432+5342-321*2 would be passed as:
432+5342=5774, so line is 5774-321*2
5774-321=5453, so line is 5453*2
5453*2=10906, so line is 10906
See how it gets broken into little bits that can be easily calculated with a function, just find each value and what is happening to them, then return the result which is then put in place of the original equation.
I hope your not wondering what this has to do with IF statement, because after you've done your math passes, you might have something like:
IF valuea=(32+5342-321*2)
Which would be converted to:
IF 4423=10906
Then, it's easy to check this with a function in a similar fashion to the calculator function, even if the function returned a 1 if the check passed, 'IF 1' could be an indicator to perform the lines until the ENDIF.
Van-B
My cats breath smells of cat food.