Personally what I would do, keeping in mind this is the simple and very inefficient way of doing it, would be to setup a switch statement.
For each token, setup a corresponding segment in your switch statement that will handle what you want done.
for example
Code:
switch Token
on OPERATOR {
instert parse code here and call corresponding function
}
I apologize for any coding errors in that, I'm quite rusty when it comes to coding.