thank you all for your help. I've been working on it when I have free time. I've decided to do a recursive sort of thingy that goes like this:
Code:
function parse(str[],int k
if the array element k is high_op, call parse again, start at k+1
if element is low_op, call parse again, start at k+1
if element is digit, return element
the problem i am having is trying to deal with the recursion concept. I just can't seem to get a handle on it. Will the above handle the order of operations correctly, since high_op is checked for low_op? About the linking: Does each successive parse result become a parent of the previous result?
Code:
int parse(char fstr[],int start)
{
int i;
int val;
char c;
for (i=start+1;i<length;i++){
c=fstr[i];
if (pri_op(c)) {array[i]->data=parse(fstr,i);}
else if (sec_op(c)) {array[i]->data=parse(fstr,i);}
else if (isdigit(c)) {array[i]->data=c-'0';}
/*not sure about where to go from here*/
I would appreciate as always any help. Is there an easy way to write out a Backus Naur Form specification type of thingie in C?