So basically - there are no trees, although the representation in memory for some things is tree-like, it uses recursion to do the heavy lifting. This may be a bottleneck but it was also the easiest to program and understand.
Ah yeah. Before I recoded my solver, it relied solely on recursion. It'd constantly loop through the equation looking for things to solve. Made it incredibly slow. Now the parser takes care of that and there's no recursion in the solver, just a straight shot through.
At first I thought taking out recursion that it'd be quite a bit more complicated and less friendly but, that's not true. It actually is kinda easier, most of everything is chunked together in the parser instead of part in the parser, part in the solver.
Here's a little description of how it works:
User types in:
Parser breaks that up into: let, x, =, 1,+,5,-,3,*,2
X is identified as a variable. This line is marked as a variable setting line. Everything after = is identified as the equation.
The parser takes that equation and sticks it into an equation parser. Which looks through and breaks the equation into equation objects:
Eq1 is 3*2
Eq2 Â is 1+5
Eq3 is Eq2 - Eq1
Then it realizes that the equation is all broken down into tree form and returns Eq3 as the base.
So after the parser, the runtime runs each line of code.
It realizes that the line is setting a variable, it takes the variable and the equation, Eq3, and it calls the solve function of Eq3.
Eq3 is the base so it calls solve on Eq2 and Eq1. Looks like:
Eq3 = Eq2 - Eq1
Eq3 = 6 - Eq1
Eq3 = 6 - 6
Returns 0.
Then the runtime takes the returned 0 and stores it in the variable.
There's no searching for stuff to solve, it just knows what to solve.
@Matt: I gotta say man, I'm pretty impressed. I'm not sure if you're aware of this, but the way you handled the interpreter is in essence the "standard" (and supposedly best) way too do it. At least according to my laymans understanding. Many kudos.
Thanks.
I've worked on it a bit more. So...
New Features- LET is no longer require, can be used but makes no difference.
- +=, -=, *=, and /= have been added.
Here's the download:
Gan's RuntimeMini manual:
Making Variables//Either form can be use
Let x = 1
or
x = 1
Let x$ = "test"
or
x$ = "test"
Variable Equations//+=, -=, *=, and /= are supported
x = x + 5
or
x += 5
Complex Equations//Complex equations are handled with ease.
x = (5 * (3 + 1) / 6 * 18) - 3
If Statement//If statements and nested if statements work well.
If  x < 5 Then
x+=1
End If
For Statement//For and nested for statements work.
For i = 1 to 5
x+=1
next
I'm thinking of adding support for comments, more commands, and rudimentary debugging but I'm not sure. But since I don't have plans for this, I'm really not sure what would be the point.