Hello,
I am studying compiling principle of C programming, but I have no idea where I can start with. For example, how can it parse the text input by a user?
To make the problem clearer, I will take an example. Say you have an expression, like "(a<1.5) OR (b='abc') AND (2 of (c>0, NOT(d>1), (e='cde') AND (f+g*h/i<1))......". (the expression: 2 of (c>0, NOT(d>1), (e='cde') AND (f+g*h/i<1) means when 2 expressions in the brackets are true, the expression is true). When input by user, those a, b, c,d will be replaced by real value, like "(1<1.5) OR ('cde'='abc') AND (2 of (1>0, NOT(5>1), ('cde'='cde') AND (4+8*2/3<1))". You must compute the result of the expression. Do you know what I mean?
What I want to know is whether you could kindly give me some enlightenment. I really do not know what technique to use to parse the expression, and how to use some data structure to compute the result, (using a linked list, or something else, and also paying attention to the priority of the operator.)
Any real implementation or information resource will be appreciated.
 
 
Cheng Xom

Reply via email to